Change in osmocom-bb[master]: trxcon: suppress WARNING log message on NEIGH_PM_REQ

2018-08-15 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/10432 )

Change subject: trxcon: suppress WARNING log message on NEIGH_PM_REQ
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/10432/1/src/host/trxcon/l1ctl.c
File src/host/trxcon/l1ctl.c:

https://gerrit.osmocom.org/#/c/10432/1/src/host/trxcon/l1ctl.c@796
PS1, Line 796:  case L1CTL_NEIGH_PM_REQ:
> I think it makes much more sense to define _L1CTL_MAX, and […]
Ah, nope, sorry. It wouldn't catch unimplemented messages
anyway. Probably, setting the log level of "Unknown MSG ..."
message to LOGL_NOTICE would make sense...

But I am still not sure that adding more L1CTL messages here
just to indicate that they are not supported / implemented
is not a good idea.

After all, it's just a warning message, which doesn't affect
the normal operation of this program ;)



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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Id76993056fb514e6fb0242d505205316c61bb965
Gerrit-Change-Number: 10432
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Wed, 15 Aug 2018 21:45:45 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-bts[master]: send TCH/F fill frames in DTX mode (WIP)

2018-08-15 Thread Stefan Sperling
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/10415

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

Change subject: send TCH/F fill frames in DTX mode (WIP)
..

send TCH/F fill frames in DTX mode (WIP)

Send DTX TCH fill frames according to GSM 05.08, section 8.3.

Change-Id: I7bff00b8cf41dc1b0e6e668173bebce23be0d253
Related: OS#1950
---
M src/common/l1sap.c
1 file changed, 64 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/15/10415/2
--
To view, visit https://gerrit.osmocom.org/10415
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I7bff00b8cf41dc1b0e6e668173bebce23be0d253
Gerrit-Change-Number: 10415
Gerrit-PatchSet: 2
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Stefan Sperling 
Gerrit-CC: Harald Welte 


Change in osmo-ttcn3-hacks[master]: update DTX fill frame test expectations

2018-08-15 Thread Stefan Sperling
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/10414

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

Change subject: update DTX fill frame test expectations
..

update DTX fill frame test expectations

Fix an off-by-one in frame number comparison: Ensure that we
won't stop testing until after fn + 104 has been received.

The DTX test case would never pass since the alt statement
was always repeated even if enough frames had been received.
Fix this by moving code which runs before frame fn + 104 is
received into an 'else' cause.

We receive SACCH frames in DTX mode so we must account for them.
Introduce separate counters for SACCH and non-SACCH fill frames
to make test failure diagnosis easier. Note that we cannot expect
a specific amount of SACCH frames during a particular test run
since their amount depends on what the current frame number window
happens to be. We can however add the counters for SACCH and
non-SACCH fill frames and obtain a meaningful result.

Change-Id: Ie573b54ab5654f027c470aa7a565d2b5b97dc74b
Related: OS#1950
---
M bts/BTS_Tests.ttcn
1 file changed, 47 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/14/10414/2
--
To view, visit https://gerrit.osmocom.org/10414
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie573b54ab5654f027c470aa7a565d2b5b97dc74b
Gerrit-Change-Number: 10414
Gerrit-PatchSet: 2
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Stefan Sperling 
Gerrit-CC: Harald Welte 


Change in osmo-ttcn3-hacks[master]: update DTX fill frame test expectations

2018-08-15 Thread Stefan Sperling
Stefan Sperling has posted comments on this change. ( 
https://gerrit.osmocom.org/10414 )

Change subject: update DTX fill frame test expectations
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/10414/1/bts/BTS_Tests.ttcn
File bts/BTS_Tests.ttcn:

https://gerrit.osmocom.org/#/c/10414/1/bts/BTS_Tests.ttcn@3840
PS1, Line 3840: 52, 53, 54, 55, 56, 57, 58, 5
> this is listing all eitght bursts that are required during DTX on a TCH/F. […]
I have made some changes that I believe align with your suggestions, which I 
will push here soon.
However, the test is still failing with:

BTS_Tests.ttcn:3912 Received DTX TCH fill frame with bad frame number: 268 (mod 
104: 60) (mod 26: 8)

I have read up on the structure and hierarchy of GSM frames, and what you're 
suggesting now makes a lot of sense to me.
But I am still struggling to understand the exact relationship of TCH/F frame 
numbers sent by osmo-bts and received in TTCN3.

For an unrelated AGCH PCH frame, sent by osmo-bts on chan_nr=144 fn=159, I can 
easily make out the corresponding frame
in the TTCN3 test log (the channel matches and the frame number also matches).

For TCH/F, when osmo-bts is sending:
l1sap.c:805 000160/00/04/07/04 sending fill frame TCH chan_nr=9 fn=160 
dtx=enabled
then I cannot locate the corresponding frame in the TTCN3 test's log by frame 
number (even though frame 160 should start a block).

However, for this frame:
l1sap.c:805 000264/00/04/09/08 sending fill frame TCH chan_nr=9 fn=264 
dtx=enabled
I can locate a logged message that looks like it corresponds in terms of 
channel, frame number, and payload:

19:45:38.982505 6 L1CTL_PortType.ttcn:212 dec_L1ctlDlMessageLV(): Decoded 
@L1CTL_Types.L1ctlDlMessageLV: {
len := 39,
msg := {
header := {
msg_type := L1CTL_DATA_IND (3),
flags := {
padding := '000'B,
f_done := false
},
padding := ''O
},
dl_info := {
chan_nr := {
u := {
ch0 := RSL_CHAN_NR_Bm_ACCH (1)
},
tn := 1
},
link_id := {
c := FACCH_SDCCH (0),
na := false,
prio := SAPI0_PRIO_NORMAL (0),
sapi := 0
},
arfcn := {
pcs := false,
arfcn := 871
},
frame_nr := 264,
rx_level := 60,
snr := 0,
num_biterr := 0,
fire_crc := 0
},
payload := {
data_ind := {
payload := '0303012B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B'O
}
}
}
}



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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie573b54ab5654f027c470aa7a565d2b5b97dc74b
Gerrit-Change-Number: 10414
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Stefan Sperling 
Gerrit-CC: Harald Welte 
Gerrit-Comment-Date: Wed, 15 Aug 2018 18:05:25 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-sgsn[master]: Drop gprs_msgb_resize_area with libosmocore replacement

2018-08-15 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/10462 )

Change subject: Drop gprs_msgb_resize_area with libosmocore replacement
..


Patch Set 1: Code-Review+1


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

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib80f7b2b186d87f21d63d9b0bec58175170c905c
Gerrit-Change-Number: 10462
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Wed, 15 Aug 2018 16:35:34 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-sip-connector[master]: sdp: remove htonl() from in_addr

2018-08-15 Thread Vadim Yanitskiy
Vadim Yanitskiy has posted comments on this change. ( 
https://gerrit.osmocom.org/10452 )

Change subject: sdp: remove htonl() from in_addr
..


Patch Set 2: Code-Review+1

Fine for me now :)


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

Gerrit-Project: osmo-sip-connector
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib2bebfb905afc91afc01770df8532b749f494806
Gerrit-Change-Number: 10452
Gerrit-PatchSet: 2
Gerrit-Owner: Tobias Mädel 
Gerrit-Reviewer: Tobias Mädel 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: lynxis lazus 
Gerrit-CC: Harald Welte 
Gerrit-Comment-Date: Wed, 15 Aug 2018 16:26:00 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-sip-connector[master]: sdp: remove htonl() from in_addr

2018-08-15 Thread Tobias Mädel
Tobias Mädel has posted comments on this change. ( 
https://gerrit.osmocom.org/10452 )

Change subject: sdp: remove htonl() from in_addr
..


Patch Set 2:

Good idea. I just did that. Should be better now.


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

Gerrit-Project: osmo-sip-connector
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib2bebfb905afc91afc01770df8532b749f494806
Gerrit-Change-Number: 10452
Gerrit-PatchSet: 2
Gerrit-Owner: Tobias Mädel 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Tobias Mädel 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: lynxis lazus 
Gerrit-CC: Harald Welte 
Gerrit-Comment-Date: Wed, 15 Aug 2018 16:18:00 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-sip-connector[master]: sdp: remove htonl() from in_addr

2018-08-15 Thread Tobias Mädel
Tobias Mädel has removed Jenkins Builder from this change.  ( 
https://gerrit.osmocom.org/10452 )

Change subject: sdp: remove htonl() from in_addr
..


Removed reviewer Jenkins Builder.
--
To view, visit https://gerrit.osmocom.org/10452
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sip-connector
Gerrit-Branch: master
Gerrit-MessageType: deleteReviewer
Gerrit-Change-Id: Ib2bebfb905afc91afc01770df8532b749f494806
Gerrit-Change-Number: 10452
Gerrit-PatchSet: 2
Gerrit-Owner: Tobias Mädel 
Gerrit-Reviewer: Tobias Mädel 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: lynxis lazus 
Gerrit-CC: Harald Welte 


Change in osmo-sip-connector[master]: sdp: remove htonl() from in_addr

2018-08-15 Thread Tobias Mädel
Hello Vadim Yanitskiy, Jenkins Builder,

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

https://gerrit.osmocom.org/10452

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

Change subject: sdp: remove htonl() from in_addr
..

sdp: remove htonl() from in_addr

Change-Id: Ib2bebfb905afc91afc01770df8532b749f494806
---
M src/sdp.c
1 file changed, 1 insertion(+), 1 deletion(-)


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

Gerrit-Project: osmo-sip-connector
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ib2bebfb905afc91afc01770df8532b749f494806
Gerrit-Change-Number: 10452
Gerrit-PatchSet: 2
Gerrit-Owner: Tobias Mädel 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: lynxis lazus 
Gerrit-CC: Harald Welte 


Build failed in Jenkins: master-asn1c » a1=default,a2=default,a3=default,osmocom-master-debian9 #216

2018-08-15 Thread jenkins
See 


--
[...truncated 3.92 KB...]
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for g77... no
checking for f77... no
checking for xlf... no
checking for frt... no
checking for pgf77... no
checking for cf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for pghpf... no
checking for epcf90... no
checking for gfortran... no
checking for g95... no
checking for f95... no
checking for fort... no
checking for xlf95... no
checking for ifort... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for ftn... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether  accepts -g... no
checking the maximum length of command line arguments... 32768
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared 
libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared 
libraries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared 
libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
appending configuration tag "F77" to libtool
checking for autoconf... /usr/bin/autoconf
checking for autoheader... /usr/bin/autoheader
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking how to run the C preprocessor... gcc -E
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes

Change in osmo-sgsn[master]: Drop gprs_msgb_copy with libosmocore replacement

2018-08-15 Thread Pau Espin Pedrol
Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/10461


Change subject: Drop gprs_msgb_copy with libosmocore replacement
..

Drop gprs_msgb_copy with libosmocore replacement

gprs_msgb_copy was introduced in libosmocore 0.94
(f78ec5ce0d0f6038147d9b9e14d81094309ba5d5) as bssgp_msgb_copy. Let's use
that one to avoid code duplication.

Change-Id: I42a65fd8e4045fafadf5694f2d8d0c5e7ab350a0
---
M include/osmocom/sgsn/gprs_utils.h
M src/gprs/gb_proxy.c
M src/gprs/gprs_gmm.c
M src/gprs/gprs_utils.c
M tests/gbproxy/gbproxy_test.c
5 files changed, 6 insertions(+), 56 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/61/10461/1

diff --git a/include/osmocom/sgsn/gprs_utils.h 
b/include/osmocom/sgsn/gprs_utils.h
index e06364d..8e47e90 100644
--- a/include/osmocom/sgsn/gprs_utils.h
+++ b/include/osmocom/sgsn/gprs_utils.h
@@ -29,7 +29,6 @@
 struct msgb;
 struct gprs_ra_id;

-struct msgb *gprs_msgb_copy(const struct msgb *msg, const char *name);
 int gprs_msgb_resize_area(struct msgb *msg, uint8_t *area,
size_t old_size, size_t new_size);
 int gprs_str_to_apn(uint8_t *apn_enc, size_t max_len, const char *str);
diff --git a/src/gprs/gb_proxy.c b/src/gprs/gb_proxy.c
index 447772f..dc3c810 100644
--- a/src/gprs/gb_proxy.c
+++ b/src/gprs/gb_proxy.c
@@ -499,7 +499,7 @@
 msgb_nsei(msg),
 parse_ctx->llc_msg_name ? parse_ctx->llc_msg_name : "BSSGP");

-   stored_msg = gprs_msgb_copy(msg, "process_bssgp_ul");
+   stored_msg = bssgp_msgb_copy(msg, "process_bssgp_ul");
msgb_enqueue(_info->stored_msgs, stored_msg);

if (!link_info->imsi_acq_pending) {
@@ -763,7 +763,7 @@
 {
/* create a copy of the message so the old one can
 * be free()d safely when we return from gbprox_rcvmsg() */
-   struct msgb *msg = gprs_msgb_copy(old_msg, "msgb_relay2sgsn");
+   struct msgb *msg = bssgp_msgb_copy(old_msg, "msgb_relay2sgsn");
int rc;

DEBUGP(DGPRS, "NSEI=%u proxying BTS->SGSN (NS_BVCI=%u, NSEI=%u)\n",
@@ -787,7 +787,7 @@
 {
/* create a copy of the message so the old one can
 * be free()d safely when we return from gbprox_rcvmsg() */
-   struct msgb *msg = gprs_msgb_copy(old_msg, "msgb_relay2peer");
+   struct msgb *msg = bssgp_msgb_copy(old_msg, "msgb_relay2peer");
int rc;

DEBUGP(DGPRS, "NSEI=%u proxying SGSN->BSS (NS_BVCI=%u, NSEI=%u)\n",
@@ -1179,7 +1179,7 @@
return bssgp_tx_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, NULL, 
orig_msg);
}

-   msg = gprs_msgb_copy(orig_msg, "rx_sig_from_sgsn");
+   msg = bssgp_msgb_copy(orig_msg, "rx_sig_from_sgsn");
gbprox_process_bssgp_dl(cfg, msg, NULL);
/* Update message info */
bgph = (struct bssgp_normal_hdr *) msgb_bssgph(msg);
diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c
index 91f769d..bea63dc 100644
--- a/src/gprs/gprs_gmm.c
+++ b/src/gprs/gprs_gmm.c
@@ -2648,7 +2648,7 @@
 * and the dynamic resolution will be the right thing
 * in the long run.
 */
-   msg = gprs_msgb_copy(_msg, __func__);
+   msg = bssgp_msgb_copy(_msg, __func__);
if (!msg) {
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(_msg);
uint8_t transaction_id = gsm48_hdr_trans_id(gh);
diff --git a/src/gprs/gprs_utils.c b/src/gprs/gprs_utils.c
index d7cef1c..c4b66d6 100644
--- a/src/gprs/gprs_utils.c
+++ b/src/gprs/gprs_utils.c
@@ -30,55 +30,6 @@

 #include 

-/* FIXME: this needs to go to libosmocore/msgb.c */
-struct msgb *gprs_msgb_copy(const struct msgb *msg, const char *name)
-{
-   struct libgb_msgb_cb *old_cb, *new_cb;
-   struct msgb *new_msg;
-
-   new_msg = msgb_alloc(msg->data_len, name);
-   if (!new_msg)
-   return NULL;
-
-   /* copy data */
-   memcpy(new_msg->_data, msg->_data, new_msg->data_len);
-
-   /* copy header */
-   new_msg->len = msg->len;
-   new_msg->data += msg->data - msg->_data;
-   new_msg->head += msg->head - msg->_data;
-   new_msg->tail += msg->tail - msg->_data;
-
-   if (msg->l1h)
-   new_msg->l1h = new_msg->_data + (msg->l1h - msg->_data);
-   if (msg->l2h)
-   new_msg->l2h = new_msg->_data + (msg->l2h - msg->_data);
-   if (msg->l3h)
-   new_msg->l3h = new_msg->_data + (msg->l3h - msg->_data);
-   if (msg->l4h)
-   new_msg->l4h = new_msg->_data + (msg->l4h - msg->_data);
-
-   /* copy GB specific data */
-   old_cb = LIBGB_MSGB_CB(msg);
-   new_cb = LIBGB_MSGB_CB(new_msg);
-
-   if (old_cb->bssgph)
-   new_cb->bssgph = new_msg->_data + (old_cb->bssgph - msg->_data);
-   if (old_cb->llch)
-   new_cb->llch = new_msg->_data + (old_cb->llch - msg->_data);
-
-   /* bssgp_cell_id is a pointer into the old msgb, so we need 

Change in osmo-sgsn[master]: Drop gprs_msgb_resize_area with libosmocore replacement

2018-08-15 Thread Pau Espin Pedrol
Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/10462


Change subject: Drop gprs_msgb_resize_area with libosmocore replacement
..

Drop gprs_msgb_resize_area with libosmocore replacement

gprs_msgb_resize_area was introduced in libosmocore 0.94
(f78ec5ce0d0f6038147d9b9e14d81094309ba5d5) as msgb_resize_area. Let's use
that one to avoid code duplication.

Change-Id: Ib80f7b2b186d87f21d63d9b0bec58175170c905c
---
M include/osmocom/sgsn/gprs_utils.h
M src/gprs/gb_proxy_patch.c
M src/gprs/gprs_utils.c
3 files changed, 2 insertions(+), 40 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/62/10462/1

diff --git a/include/osmocom/sgsn/gprs_utils.h 
b/include/osmocom/sgsn/gprs_utils.h
index 8e47e90..eacaec7 100644
--- a/include/osmocom/sgsn/gprs_utils.h
+++ b/include/osmocom/sgsn/gprs_utils.h
@@ -29,8 +29,6 @@
 struct msgb;
 struct gprs_ra_id;

-int gprs_msgb_resize_area(struct msgb *msg, uint8_t *area,
-   size_t old_size, size_t new_size);
 int gprs_str_to_apn(uint8_t *apn_enc, size_t max_len, const char *str);

 /* GSM 04.08, 10.5.7.3 GPRS Timer */
diff --git a/src/gprs/gb_proxy_patch.c b/src/gprs/gb_proxy_patch.c
index 496f605..9cca9a8 100644
--- a/src/gprs/gb_proxy_patch.c
+++ b/src/gprs/gb_proxy_patch.c
@@ -112,7 +112,7 @@
 osmo_apn_to_str(str1, apn, apn_len));

*new_apn_ie_len = 0;
-   gprs_msgb_resize_area(msg, apn_ie, apn_ie_len, 0);
+   msgb_resize_area(msg, apn_ie, apn_ie_len, 0);
} else {
/* Resize the IE */
char str1[110];
@@ -129,7 +129,7 @@
   peer->cfg->core_apn_size));

*new_apn_ie_len = peer->cfg->core_apn_size + 2;
-   gprs_msgb_resize_area(msg, apn, apn_len, 
peer->cfg->core_apn_size);
+   msgb_resize_area(msg, apn, apn_len, peer->cfg->core_apn_size);
memcpy(apn, peer->cfg->core_apn, peer->cfg->core_apn_size);
hdr->apn_len = peer->cfg->core_apn_size;
}
@@ -463,4 +463,3 @@

return 1;
 }
-
diff --git a/src/gprs/gprs_utils.c b/src/gprs/gprs_utils.c
index c4b66d6..13641c1 100644
--- a/src/gprs/gprs_utils.c
+++ b/src/gprs/gprs_utils.c
@@ -30,41 +30,6 @@

 #include 

-/* TODO: Move this to libosmocore/msgb.c */
-int gprs_msgb_resize_area(struct msgb *msg, uint8_t *area,
-   size_t old_size, size_t new_size)
-{
-   int rc;
-   uint8_t *rest = area + old_size;
-   int rest_len = msg->len - old_size - (area - msg->data);
-   int delta_size = (int)new_size - (int)old_size;
-
-   if (delta_size == 0)
-   return 0;
-
-   if (delta_size > 0) {
-   rc = msgb_trim(msg, msg->len + delta_size);
-   if (rc < 0)
-   return rc;
-   }
-
-   memmove(area + new_size, area + old_size, rest_len);
-
-   if (msg->l1h >= rest)
-   msg->l1h += delta_size;
-   if (msg->l2h >= rest)
-   msg->l2h += delta_size;
-   if (msg->l3h >= rest)
-   msg->l3h += delta_size;
-   if (msg->l4h >= rest)
-   msg->l4h += delta_size;
-
-   if (delta_size < 0)
-   msgb_trim(msg, msg->len + delta_size);
-
-   return 0;
-}
-
 int gprs_str_to_apn(uint8_t *apn_enc, size_t max_len, const char *str)
 {
uint8_t *last_len_field;

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

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib80f7b2b186d87f21d63d9b0bec58175170c905c
Gerrit-Change-Number: 10462
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 


Change in meta-telephony[201705]: openbsc: Drop binaries provided by other recipes

2018-08-15 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/10451 )

Change subject: openbsc: Drop binaries provided by other recipes
..


Patch Set 2:

(2 comments)

https://gerrit.osmocom.org/#/c/10451/2/recipes-osmocom/openbsc/openbsc.inc
File recipes-osmocom/openbsc/openbsc.inc:

https://gerrit.osmocom.org/#/c/10451/2/recipes-osmocom/openbsc/openbsc.inc@39
PS2, Line 39: osmo-bsc_mgcp is provided by osmo-mgw.bb
> are you sure about this?  If so, it is IMHO actually a bug.  osmo-mgw. […]
osmo-mgw.bb generated packages with its contents:
4.0K./libosmo-legacy-mgcp.shlibdeps
4.0K./osmo-mgw/etc/osmocom/osmo-mgw.cfg
8.0K./osmo-mgw/etc/osmocom
12K ./osmo-mgw/etc
96K ./osmo-mgw/usr/bin/osmo-mgw
100K./osmo-mgw/usr/bin
104K./osmo-mgw/usr
4.0K./osmo-mgw/lib/systemd/system/osmo-mgw.service
8.0K./osmo-mgw/lib/systemd/system
12K ./osmo-mgw/lib/systemd
16K ./osmo-mgw/lib
136K./osmo-mgw
4.0K./libosmo-mgcp-client.shlibdeps
4.0K./osmo-mgw.shlibdeps
4.0K./libosmo-mgcp-dev/usr/include/osmocom/mgcp/osmux.h
8.0K./libosmo-mgcp-dev/usr/include/osmocom/mgcp/mgcp.h
12K ./libosmo-mgcp-dev/usr/include/osmocom/mgcp/mgcp_internal.h
4.0K./libosmo-mgcp-dev/usr/include/osmocom/mgcp/mgcp_common.h
32K ./libosmo-mgcp-dev/usr/include/osmocom/mgcp
36K ./libosmo-mgcp-dev/usr/include/osmocom
40K ./libosmo-mgcp-dev/usr/include
44K ./libosmo-mgcp-dev/usr
48K ./libosmo-mgcp-dev
4.0K./osmo-mgw-doc/usr/share/doc/osmo-mgw/examples/osmo-mgw/osmo-mgw.cfg
8.0K./osmo-mgw-doc/usr/share/doc/osmo-mgw/examples/osmo-mgw
4.0K./osmo-mgw-doc/usr/share/doc/osmo-mgw/examples/osmo-bsc_mgcp/mgcp.cfg
8.0K./osmo-mgw-doc/usr/share/doc/osmo-mgw/examples/osmo-bsc_mgcp
20K ./osmo-mgw-doc/usr/share/doc/osmo-mgw/examples
24K ./osmo-mgw-doc/usr/share/doc/osmo-mgw
28K ./osmo-mgw-doc/usr/share/doc
32K ./osmo-mgw-doc/usr/share
36K ./osmo-mgw-doc/usr
40K ./osmo-mgw-doc
104K./libosmo-legacy-mgcp/usr/lib/libosmo-legacy-mgcp.so.0.1.0
0   ./libosmo-legacy-mgcp/usr/lib/libosmo-legacy-mgcp.so.0
108K./libosmo-legacy-mgcp/usr/lib
112K./libosmo-legacy-mgcp/usr
116K./libosmo-legacy-mgcp
4.0K./libosmo-mgcp
4.0K./osmo-mgw-locale
288K./osmo-mgw-dbg/usr/bin/.debug/osmo-mgw
32K ./osmo-mgw-dbg/usr/bin/.debug/osmo-bsc_mgcp
324K./osmo-mgw-dbg/usr/bin/.debug
328K./osmo-mgw-dbg/usr/bin
80K ./osmo-mgw-dbg/usr/lib/.debug/libosmo-mgcp-client.so.3.1.0
240K./osmo-mgw-dbg/usr/lib/.debug/libosmo-legacy-mgcp.so.0.1.0
324K./osmo-mgw-dbg/usr/lib/.debug
328K./osmo-mgw-dbg/usr/lib
660K./osmo-mgw-dbg/usr
664K./osmo-mgw-dbg
4.0K./osmo-mgw-dev
4.0K
./libosmo-mgcp-client-dev/usr/include/osmocom/mgcp_client/mgcp_client_fsm.h
4.0K./libosmo-mgcp-client-dev/usr/include/osmocom/mgcp_client/mgcp_common.h
8.0K./libosmo-mgcp-client-dev/usr/include/osmocom/mgcp_client/mgcp_client.h
20K ./libosmo-mgcp-client-dev/usr/include/osmocom/mgcp_client
24K ./libosmo-mgcp-client-dev/usr/include/osmocom
28K ./libosmo-mgcp-client-dev/usr/include
0   ./libosmo-mgcp-client-dev/usr/lib/libosmo-mgcp-client.so
4.0K./libosmo-mgcp-client-dev/usr/lib/pkgconfig/libosmo-mgcp-client.pc
8.0K./libosmo-mgcp-client-dev/usr/lib/pkgconfig
12K ./libosmo-mgcp-client-dev/usr/lib
44K ./libosmo-mgcp-client-dev/usr
48K ./libosmo-mgcp-client-dev
36K ./libosmo-mgcp-client/usr/lib/libosmo-mgcp-client.so.3.1.0
0   ./libosmo-mgcp-client/usr/lib/libosmo-mgcp-client.so.3
40K ./libosmo-mgcp-client/usr/lib
44K ./libosmo-mgcp-client/usr
48K ./libosmo-mgcp-client
4.0K./osmo-bsc-mgcp.shlibdeps
4.0K./osmo-mgw-staticdev
4.0K./libosmo-legacy-mgcp-dev/usr/include/osmocom/legacy_mgcp/osmux.h
8.0K./libosmo-legacy-mgcp-dev/usr/include/osmocom/legacy_mgcp/mgcp.h
12K 
./libosmo-legacy-mgcp-dev/usr/include/osmocom/legacy_mgcp/mgcp_internal.h
28K ./libosmo-legacy-mgcp-dev/usr/include/osmocom/legacy_mgcp
32K ./libosmo-legacy-mgcp-dev/usr/include/osmocom
36K ./libosmo-legacy-mgcp-dev/usr/include
0   ./libosmo-legacy-mgcp-dev/usr/lib/libosmo-legacy-mgcp.so
4.0K./libosmo-legacy-mgcp-dev/usr/lib/pkgconfig/libosmo-legacy-mgcp.pc
8.0K./libosmo-legacy-mgcp-dev/usr/lib/pkgconfig
12K ./libosmo-legacy-mgcp-dev/usr/lib
52K ./libosmo-legacy-mgcp-dev/usr
56K ./libosmo-legacy-mgcp-dev
4.0K./osmo-bsc-mgcp/etc/osmocom/osmo-bsc-mgcp.cfg
8.0K./osmo-bsc-mgcp/etc/osmocom
12K ./osmo-bsc-mgcp/etc
16K ./osmo-bsc-mgcp/usr/bin/osmo-bsc_mgcp
20K ./osmo-bsc-mgcp/usr/bin
24K ./osmo-bsc-mgcp/usr
4.0K./osmo-bsc-mgcp/lib/systemd/system/osmo-bsc-mgcp.service
8.0K./osmo-bsc-mgcp/lib/systemd/system
12K ./osmo-bsc-mgcp/lib/systemd
16K ./osmo-bsc-mgcp/lib
56K ./osmo-bsc-mgcp
1.3M.


So yes, it is built by osmo-mgw (I also thought first it wasn't). 

Change in osmo-sip-connector[master]: merges commit from lynxis - changes byte order for IPv4 address in SDP

2018-08-15 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/10452 )

Change subject: merges commit from lynxis - changes byte order for IPv4 address 
in SDP
..


Patch Set 1:

Agreeing with vadim here. you can set GIT_AUTHOR_NAME / GIT_AUTHOR_EMAIL when 
doing the commit and recycle the original changelog. Thanks!


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

Gerrit-Project: osmo-sip-connector
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib2bebfb905afc91afc01770df8532b749f494806
Gerrit-Change-Number: 10452
Gerrit-PatchSet: 1
Gerrit-Owner: Tobias Mädel 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-CC: Harald Welte 
Gerrit-Comment-Date: Wed, 15 Aug 2018 08:00:40 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmocom-bb[master]: trxcon/scheduler: pass lchan to sched_bad_frame_ind()

2018-08-15 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/10456 )

Change subject: trxcon/scheduler: pass lchan to sched_bad_frame_ind()
..

trxcon/scheduler: pass lchan to sched_bad_frame_ind()

Instead of passing the information about a logical channel, it
makes sense to pass the pointer to its state where everything
is stored. This approach would allow to avoid adding more
arguments every time, e.g. in case of AMR.

Change-Id: I91fe86fef43aac68776a58c9acc37ef2a9ee8042
---
M src/host/trxcon/sched_lchan_common.c
M src/host/trxcon/sched_lchan_tchf.c
M src/host/trxcon/sched_prim.c
M src/host/trxcon/sched_trx.h
4 files changed, 10 insertions(+), 14 deletions(-)

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



diff --git a/src/host/trxcon/sched_lchan_common.c 
b/src/host/trxcon/sched_lchan_common.c
index 47b0162..03cdc67 100644
--- a/src/host/trxcon/sched_lchan_common.c
+++ b/src/host/trxcon/sched_lchan_common.c
@@ -139,17 +139,17 @@
  * Composes a bad frame indication message
  * according to the current tch_mode.
  *
- * @param  l2   Pointer to allocated byte array
- * @param  tch_mode Current TCH mode
+ * @param  l2   Caller-allocated byte array
+ * @param  lchanLogical channel to generate BFI for
  * @return  How much bytes were written
  */
-size_t sched_bad_frame_ind(uint8_t *l2, uint8_t rsl_cmode, uint8_t tch_mode)
+size_t sched_bad_frame_ind(uint8_t *l2, struct trx_lchan_state *lchan)
 {
/* BFI is only required for speech */
-   if (rsl_cmode != RSL_CMOD_SPD_SPEECH)
+   if (lchan->rsl_cmode != RSL_CMOD_SPD_SPEECH)
return 0;

-   switch (tch_mode) {
+   switch (lchan->tch_mode) {
case GSM48_CMODE_SIGN:
case GSM48_CMODE_SPEECH_V1: /* Full Rate */
memset(l2, 0x00, GSM_FR_BYTES);
@@ -163,7 +163,7 @@
/* FIXME: AMR is not implemented yet */
return 0;
default:
-   LOGP(DSCH, LOGL_ERROR, "Invalid TCH mode: %u\n", tch_mode);
+   LOGP(DSCH, LOGL_ERROR, "Invalid TCH mode: %u\n", 
lchan->tch_mode);
return 0;
}
 }
diff --git a/src/host/trxcon/sched_lchan_tchf.c 
b/src/host/trxcon/sched_lchan_tchf.c
index e20b461..86cdb12 100644
--- a/src/host/trxcon/sched_lchan_tchf.c
+++ b/src/host/trxcon/sched_lchan_tchf.c
@@ -166,7 +166,7 @@

 bfi:
/* Bad frame indication */
-   l2_len = sched_bad_frame_ind(l2, rsl_cmode, tch_mode);
+   l2_len = sched_bad_frame_ind(l2, lchan);

/* Didn't try to decode */
if (n_errors < 0)
diff --git a/src/host/trxcon/sched_prim.c b/src/host/trxcon/sched_prim.c
index acd08bf..2aeaa5d 100644
--- a/src/host/trxcon/sched_prim.c
+++ b/src/host/trxcon/sched_prim.c
@@ -373,12 +373,8 @@
 * other channels: LAPDm fill frame.
 */
if (CHAN_IS_TCH(chan) && TCH_MODE_IS_SPEECH(tch_mode)) {
-   /**
-* Silence frame indication
-* HACK: use actual rsl_cmode!
-*/
-   prim_len = sched_bad_frame_ind(prim_buffer,
-   RSL_CMOD_SPD_SPEECH, tch_mode);
+   /* Bad frame indication */
+   prim_len = sched_bad_frame_ind(prim_buffer, lchan);
} else if (CHAN_IS_TCH(chan) && TCH_MODE_IS_DATA(tch_mode)) {
/* FIXME: should we do anything for CSD? */
return 0;
diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h
index f3fa9df..2aafbf0 100644
--- a/src/host/trxcon/sched_trx.h
+++ b/src/host/trxcon/sched_trx.h
@@ -317,7 +317,7 @@
 /* Shared declarations for lchan handlers */
 extern const uint8_t sched_nb_training_bits[8][26];

-size_t sched_bad_frame_ind(uint8_t *l2, uint8_t rsl_cmode, uint8_t tch_mode);
+size_t sched_bad_frame_ind(uint8_t *l2, struct trx_lchan_state *lchan);
 int sched_send_dt_ind(struct trx_instance *trx, struct trx_ts *ts,
struct trx_lchan_state *lchan, uint8_t *l2, size_t l2_len,
int bit_error_count, bool dec_failed, bool traffic);

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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I91fe86fef43aac68776a58c9acc37ef2a9ee8042
Gerrit-Change-Number: 10456
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in osmocom-bb[master]: trxcon/sched_prim.c: properly handle both TCH/H and FACCH/H prims

2018-08-15 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/10455 )

Change subject: trxcon/sched_prim.c: properly handle both TCH/H and FACCH/H 
prims
..

trxcon/sched_prim.c: properly handle both TCH/H and FACCH/H prims

Initially it was assumed that FACCH prioritization should be done
in the same way for both TCH/F and TCH/H. Moreover, it was not
possible to confirm this, because TCH/H was (and still) not
implemented yet. But according to the specs:

  - unlike FACCH/F, FACCH/H transmissions shall be aligned
within a multiframe, i.e. can only be initiated on
particular frame numbers (see GSM 05.02, clause 7);

  - unlike FACCH/F, a FACCH/H frame steals two TCH/F frames;

so the TCH/H (including FACCH/H) primitives should be handled
separately from the TCH/F (including FACCH/F) primitives.

Change-Id: I9b59f60e1cbac8fb8fd557b6c67b5e376c0a6bbb
---
M src/host/trxcon/sched_prim.c
M src/host/trxcon/sched_trx.c
M src/host/trxcon/sched_trx.h
3 files changed, 86 insertions(+), 6 deletions(-)

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



diff --git a/src/host/trxcon/sched_prim.c b/src/host/trxcon/sched_prim.c
index 4987379..acd08bf 100644
--- a/src/host/trxcon/sched_prim.c
+++ b/src/host/trxcon/sched_prim.c
@@ -223,25 +223,105 @@
 }

 /**
+ * Dequeues either a TCH/H, or a FACCH/H prim (preferred).
+ * If a FACCH/H prim is found, two TCH/H prims are being
+ * dropped (i.e. replaced).
+ *
+ * According to GSM 05.02, the following blocks can be used
+ * to carry FACCH/H data (see clause 7, table 1 of 9):
+ *
+ * UL FACCH/H0:
+ * B0(0,2,4,6,8,10), B1(8,10,13,15,17,19), B2(17,19,21,23,0,2)
+ *
+ * UL FACCH/H1:
+ * B0(1,3,5,7,9,11), B1(9,11,14,16,18,20), B2(18,20,22,24,1,3)
+ *
+ * where the numbers within brackets are fn % 26.
+ *
+ * @param  queue  transmit queue to take a prim from
+ * @param  fn the current frame number
+ * @param  lchan_type required channel type of a primitive,
+ * @returneither a FACCH/H, or a TCH/H primitive,
+ *otherwise NULL
+ */
+static struct trx_ts_prim *prim_dequeue_tch_h(struct llist_head *queue,
+   uint32_t fn, enum trx_lchan_type lchan_type)
+{
+   struct trx_ts_prim *facch;
+   struct trx_ts_prim *tch;
+   bool facch_now = false;
+   uint32_t fn_mf;
+
+   /* Traffic multiframe period */
+   fn_mf = fn % 26;
+
+   /* FACCH/H0 frame alignment */
+   if (lchan_type == TRXC_TCHH_0)
+   if (fn_mf == 0 || fn_mf == 8 || fn_mf == 17)
+   facch_now = true;
+
+   /* FACCH/H1 frame alignment */
+   if (lchan_type == TRXC_TCHH_1)
+   if (fn_mf == 1 || fn_mf == 9 || fn_mf == 18)
+   facch_now = true;
+
+   /* If FACCH/H is not allowed for a given frame number */
+   if (!facch_now) /* Just dequeue a TCH/H prim */
+   goto no_facch;
+
+   /* If there are no FACCH/H prims in the queue */
+   facch = prim_dequeue_tch(queue, lchan_type, true);
+   if (!facch) /* Just dequeue a TCH/H prim */
+   goto no_facch;
+
+   /* FACCH/H prim replaces two TCH/F prims */
+   tch = prim_dequeue_tch(queue, lchan_type, false);
+   if (tch) {
+   /* At least one TCH/H prim is dropped */
+   talloc_free(tch);
+
+   /* Attempt to find another */
+   tch = prim_dequeue_tch(queue, lchan_type, false);
+   if (tch) /* Drop the second TCH/H prim */
+   talloc_free(tch);
+   }
+
+   return facch;
+
+no_facch:
+   return prim_dequeue_tch(queue, lchan_type, false);
+}
+
+/**
  * Dequeues a single primitive of required type
  * from a specified transmit queue.
  *
  * @param  queue  a transmit queue to take a prim from
+ * @param  fn the current frame number (used for FACCH/H)
  * @param  lchan_type required primitive type
  * @returna primitive or NULL if not found
  */
 struct trx_ts_prim *sched_prim_dequeue(struct llist_head *queue,
-   enum trx_lchan_type lchan_type)
+   uint32_t fn, enum trx_lchan_type lchan_type)
 {
/* There is nothing to dequeue */
if (llist_empty(queue))
return NULL;

-   /* TCH requires FACCH prioritization, so handle it separately */
-   if (CHAN_IS_TCH(lchan_type))
+   switch (lchan_type) {
+   /* TCH/F requires FACCH/F prioritization */
+   case TRXC_TCHF:
return prim_dequeue_tch_f(queue);

-   return prim_dequeue_one(queue, lchan_type);
+   /* FACCH/H prioritization is a bit more complex */
+   case TRXC_TCHH_0:
+   case TRXC_TCHH_1:
+   return prim_dequeue_tch_h(queue, fn, lchan_type);
+
+   /* Other kinds of logical channels */
+   default:
+   return prim_dequeue_one(queue, lchan_type);
+   }
 }

 /**
diff 

Change in osmocom-bb[master]: trxcon/scheduler: fix: properly generate BFI for TCH/H

2018-08-15 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/10457 )

Change subject: trxcon/scheduler: fix: properly generate BFI for TCH/H
..

trxcon/scheduler: fix: properly generate BFI for TCH/H

When relying on GSM 04.08 channel mode (GSM48_CMODE_*), one should
distinguish between Bm (full rate) and Lm (half rate) channels.

This change prevents the scheduler from generating TCH/F BFI
instead of TCH/H BFI on the corresponding channels.

Change-Id: I4547aa7f6d38637692fef8a0122e85fb52039a46
---
M src/host/trxcon/sched_lchan_common.c
1 file changed, 10 insertions(+), 4 deletions(-)

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



diff --git a/src/host/trxcon/sched_lchan_common.c 
b/src/host/trxcon/sched_lchan_common.c
index 03cdc67..76a32fe 100644
--- a/src/host/trxcon/sched_lchan_common.c
+++ b/src/host/trxcon/sched_lchan_common.c
@@ -151,10 +151,16 @@

switch (lchan->tch_mode) {
case GSM48_CMODE_SIGN:
-   case GSM48_CMODE_SPEECH_V1: /* Full Rate */
-   memset(l2, 0x00, GSM_FR_BYTES);
-   l2[0] = 0xd0;
-   return GSM_FR_BYTES;
+   case GSM48_CMODE_SPEECH_V1:
+   if (lchan->type == TRXC_TCHF) { /* Full Rate */
+   memset(l2, 0x00, GSM_FR_BYTES);
+   l2[0] = 0xd0;
+   return GSM_FR_BYTES;
+   } else { /* Half Rate */
+   memset(l2 + 1, 0x00, GSM_HR_BYTES);
+   l2[0] = 0x70; /* F = 0, FT = 111 */
+   return GSM_HR_BYTES + 1;
+   }
case GSM48_CMODE_SPEECH_EFR: /* Enhanced Full Rate */
memset(l2, 0x00, GSM_EFR_BYTES);
l2[0] = 0xc0;

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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I4547aa7f6d38637692fef8a0122e85fb52039a46
Gerrit-Change-Number: 10457
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in osmocom-bb[master]: trxcon/sched_trx.h: add missing parentheses to PRIM_IS_*

2018-08-15 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/10453 )

Change subject: trxcon/sched_trx.h: add missing parentheses to PRIM_IS_*
..

trxcon/sched_trx.h: add missing parentheses to PRIM_IS_*

Change-Id: Ifa7d9f806b3f18f2dfec931252f5119441b30e8a
---
M src/host/trxcon/sched_trx.h
1 file changed, 2 insertions(+), 2 deletions(-)

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



diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h
index 17e30bf..cd9c0e4 100644
--- a/src/host/trxcon/sched_trx.h
+++ b/src/host/trxcon/sched_trx.h
@@ -296,10 +296,10 @@
(trx_lchan_desc[chan].link_id & TRX_CH_LID_SACCH)

 #define PRIM_IS_TCH(prim) \
-   CHAN_IS_TCH(prim->chan) && prim->payload_len != GSM_MACBLOCK_LEN
+   (CHAN_IS_TCH(prim->chan) && prim->payload_len != GSM_MACBLOCK_LEN)

 #define PRIM_IS_FACCH(prim) \
-   CHAN_IS_TCH(prim->chan) && prim->payload_len == GSM_MACBLOCK_LEN
+   (CHAN_IS_TCH(prim->chan) && prim->payload_len == GSM_MACBLOCK_LEN)

 struct trx_ts_prim *sched_prim_dequeue(struct llist_head *queue,
enum trx_lchan_type lchan_type);

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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifa7d9f806b3f18f2dfec931252f5119441b30e8a
Gerrit-Change-Number: 10453
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in osmocom-bb[master]: trxcon/scheduler: fix: properly generate BFI for TCH/H

2018-08-15 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/10457 )

Change subject: trxcon/scheduler: fix: properly generate BFI for TCH/H
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I4547aa7f6d38637692fef8a0122e85fb52039a46
Gerrit-Change-Number: 10457
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 15 Aug 2018 07:57:33 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmocom-bb[master]: trxcon/scheduler: get rid of useless lchan->rsl_mode

2018-08-15 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/10458 )

Change subject: trxcon/scheduler: get rid of useless lchan->rsl_mode
..

trxcon/scheduler: get rid of useless lchan->rsl_mode

This field of the logical channel state structure was not used at
all as there is nothing related to A-bis / RSL in trxcon itself.

Change-Id: Iec1abf777a74cf57deadafa95e2337cba5d02842
---
M src/host/trxcon/sched_lchan_common.c
M src/host/trxcon/sched_lchan_tchf.c
M src/host/trxcon/sched_prim.c
M src/host/trxcon/sched_trx.c
M src/host/trxcon/sched_trx.h
5 files changed, 5 insertions(+), 26 deletions(-)

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



diff --git a/src/host/trxcon/sched_lchan_common.c 
b/src/host/trxcon/sched_lchan_common.c
index 76a32fe..2767b90 100644
--- a/src/host/trxcon/sched_lchan_common.c
+++ b/src/host/trxcon/sched_lchan_common.c
@@ -36,7 +36,6 @@
 #include 

 #include 
-#include 

 #include "l1ctl_proto.h"
 #include "scheduler.h"
@@ -145,10 +144,6 @@
  */
 size_t sched_bad_frame_ind(uint8_t *l2, struct trx_lchan_state *lchan)
 {
-   /* BFI is only required for speech */
-   if (lchan->rsl_cmode != RSL_CMOD_SPD_SPEECH)
-   return 0;
-
switch (lchan->tch_mode) {
case GSM48_CMODE_SIGN:
case GSM48_CMODE_SPEECH_V1:
diff --git a/src/host/trxcon/sched_lchan_tchf.c 
b/src/host/trxcon/sched_lchan_tchf.c
index 86cdb12..f6465f9 100644
--- a/src/host/trxcon/sched_lchan_tchf.c
+++ b/src/host/trxcon/sched_lchan_tchf.c
@@ -30,7 +30,6 @@
 #include 

 #include 
-#include 
 #include 

 #include 
@@ -50,7 +49,6 @@
 {
const struct trx_lchan_desc *lchan_desc;
int n_errors = -1, n_bits_total, rc;
-   uint8_t rsl_cmode, tch_mode, mode;
sbit_t *buffer, *offset;
uint8_t l2[128], *mask;
uint32_t *first_fn;
@@ -92,15 +90,6 @@
if (bid != 3)
return 0;

-   /**
-* Get current RSL / TCH modes
-*
-* FIXME: we do support speech only, and
-* CSD support may be implemented latter.
-*/
-   rsl_cmode = RSL_CMOD_SPD_SPEECH;
-   tch_mode = lchan->tch_mode;
-
/* Check for complete set of bursts */
if ((*mask & 0xf) != 0xf) {
LOGP(DSCHD, LOGL_ERROR, "Received incomplete traffic frame at "
@@ -113,10 +102,7 @@
goto bfi;
}

-   mode = rsl_cmode != RSL_CMOD_SPD_SPEECH ?
-   GSM48_CMODE_SPEECH_V1 : tch_mode;
-
-   switch (mode) {
+   switch (lchan->tch_mode) {
case GSM48_CMODE_SIGN:
case GSM48_CMODE_SPEECH_V1: /* FR */
rc = gsm0503_tch_fr_decode(l2, buffer,
@@ -134,7 +120,7 @@
LOGP(DSCHD, LOGL_ERROR, "AMR isn't supported yet\n");
return -ENOTSUP;
default:
-   LOGP(DSCHD, LOGL_ERROR, "Invalid TCH mode: %u\n", tch_mode);
+   LOGP(DSCHD, LOGL_ERROR, "Invalid TCH mode: %u\n", 
lchan->tch_mode);
return -EINVAL;
}

diff --git a/src/host/trxcon/sched_prim.c b/src/host/trxcon/sched_prim.c
index 2aeaa5d..e663bc3 100644
--- a/src/host/trxcon/sched_prim.c
+++ b/src/host/trxcon/sched_prim.c
@@ -32,7 +32,6 @@
 #include 

 #include 
-#include 

 #include "scheduler.h"
 #include "sched_trx.h"
diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c
index fd43a56..8bd3c72 100644
--- a/src/host/trxcon/sched_trx.c
+++ b/src/host/trxcon/sched_trx.c
@@ -465,8 +465,7 @@
lchan->dl_ongoing_facch = 0;
lchan->ul_ongoing_facch = 0;

-   lchan->rsl_cmode = 0x00;
-   lchan->tch_mode = 0x00;
+   lchan->tch_mode = GSM48_CMODE_SIGN;

/* Reset AMR state */
memset(>amr, 0x00, sizeof(lchan->amr));
diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h
index 2aafbf0..730923b 100644
--- a/src/host/trxcon/sched_trx.h
+++ b/src/host/trxcon/sched_trx.h
@@ -167,8 +167,8 @@
/*! \brief A primitive being sent */
struct trx_ts_prim *prim;

-   /*! \brief Mode for TCH channels */
-   uint8_t rsl_cmode, tch_mode;
+   /*! \brief Mode for TCH channels (see GSM48_CMODE_*) */
+   uint8_t tch_mode;

/*! \brief FACCH/H on downlink */
uint8_t dl_ongoing_facch;

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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iec1abf777a74cf57deadafa95e2337cba5d02842
Gerrit-Change-Number: 10458
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in osmocom-bb[master]: trxcon/sched_prim.c: refactor prim dequeuing logic

2018-08-15 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/10454 )

Change subject: trxcon/sched_prim.c: refactor prim dequeuing logic
..

trxcon/sched_prim.c: refactor prim dequeuing logic

The previous primitive dequeuing logic (especially for TCH/F
channels) was a bit complicated, and it could not be possible
to reuse the existing code parts in the upcoming implementation
of both TCH/H and FACCH/H channels without changing anything.

In particular, this change introduces two internal functions:

  - prim_dequeue_one(), which merely dequeues a primitive
of a given channel type (e.g. TRXC_SDCCH4_0);

  - prim_dequeue_tch(), which dequeues either a FACCH,
or a speech TCH primitive of a given channel
type (Lm or Bm).

So the logic of the TCH/F prim dequeuing function has become
cleaner, and the upcoming TCH/H prim dequeuing function, where
FACCH/H prioritization is more complex than FACCH/F, will
reuse the introduced functions.

Change-Id: Ib82ad2480ab1bc6b1df9576eb2bf5acbd398bf66
---
M src/host/trxcon/sched_prim.c
1 file changed, 82 insertions(+), 54 deletions(-)

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



diff --git a/src/host/trxcon/sched_prim.c b/src/host/trxcon/sched_prim.c
index 2ee06d7..4987379 100644
--- a/src/host/trxcon/sched_prim.c
+++ b/src/host/trxcon/sched_prim.c
@@ -128,61 +128,98 @@
return 0;
 }

+/* Dequeues a primitive of a given channel type */
+static struct trx_ts_prim *prim_dequeue_one(struct llist_head *queue,
+   enum trx_lchan_type lchan_type)
+{
+   struct trx_ts_prim *prim;
+
+   /**
+* There is no need to use the 'safe' list iteration here
+* as an item removal is immediately followed by return.
+*/
+   llist_for_each_entry(prim, queue, list) {
+   if (prim->chan == lchan_type) {
+   llist_del(>list);
+   return prim;
+   }
+   }
+
+   return NULL;
+}
+
 /**
- * Dequeues a TCH or FACCH frame, prioritizing the second.
- * In case if a FACCH frame is found, a TCH frame is being
+ * Dequeues either a FACCH, or a speech TCH primitive
+ * of a given channel type (Lm or Bm).
+ *
+ * Note: we could avoid 'lchan_type' parameter and just
+ * check the prim's channel type using CHAN_IS_TCH(),
+ * but the current approach is a bit more flexible,
+ * and allows one to have both sub-slots of TCH/H
+ * enabled on same timeslot e.g. for testing...
+ *
+ * @param  queue  transmit queue to take a prim from
+ * @param  lchan_type required channel type of a primitive,
+ *e.g. TRXC_TCHF, TRXC_TCHH_0, or TRXC_TCHH_1
+ * @param  facch  FACCH (true) or speech (false) prim?
+ * @returneither a FACCH, or a TCH primitive if found,
+ *otherwise NULL
+ */
+static struct trx_ts_prim *prim_dequeue_tch(struct llist_head *queue,
+   enum trx_lchan_type lchan_type, bool facch)
+{
+   struct trx_ts_prim *prim;
+
+   /**
+* There is no need to use the 'safe' list iteration here
+* as an item removal is immediately followed by return.
+*/
+   llist_for_each_entry(prim, queue, list) {
+   if (prim->chan != lchan_type)
+   continue;
+
+   /* Either FACCH, or not FACCH */
+   if (PRIM_IS_FACCH(prim) != facch)
+   continue;
+
+   llist_del(>list);
+   return prim;
+   }
+
+   return NULL;
+}
+
+/**
+ * Dequeues either a TCH/F, or a FACCH/F prim (preferred).
+ * If a FACCH/F prim is found, one TCH/F prim is being
  * dropped (i.e. replaced).
  *
  * @param  queue a transmit queue to take a prim from
- * @return   a FACCH or TCH primitive, otherwise NULL
+ * @return   either a FACCH/F, or a TCH/F primitive,
+ *   otherwise NULL
  */
-static struct trx_ts_prim *sched_prim_dequeue_tch(struct llist_head *queue)
+static struct trx_ts_prim *prim_dequeue_tch_f(struct llist_head *queue)
 {
-   struct trx_ts_prim *facch = NULL;
-   struct trx_ts_prim *tch = NULL;
-   struct trx_ts_prim *i;
+   struct trx_ts_prim *facch;
+   struct trx_ts_prim *tch;

-   /* Attempt to find a pair of FACCH and TCH frames */
-   llist_for_each_entry(i, queue, list) {
-   /* Find one FACCH frame */
-   if (!facch && PRIM_IS_FACCH(i))
-   facch = i;
+   /* Attempt to find a pair of both FACCH/F and TCH/F frames */
+   facch = prim_dequeue_tch(queue, TRXC_TCHF, true);
+   tch = prim_dequeue_tch(queue, TRXC_TCHF, false);

-   /* Find one TCH frame */
-   if (!tch && PRIM_IS_TCH(i))
-   tch = i;
-
-   /* If both are found */
-   if (facch && tch)
-   break;
-   }
-
-   /* Prioritize 

Change in osmocom-bb[master]: trxcon/scheduler: get rid of useless lchan->rsl_mode

2018-08-15 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/10458 )

Change subject: trxcon/scheduler: get rid of useless lchan->rsl_mode
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iec1abf777a74cf57deadafa95e2337cba5d02842
Gerrit-Change-Number: 10458
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 15 Aug 2018 07:57:53 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmocom-bb[master]: trxcon/scheduler: pass lchan to sched_bad_frame_ind()

2018-08-15 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/10456 )

Change subject: trxcon/scheduler: pass lchan to sched_bad_frame_ind()
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I91fe86fef43aac68776a58c9acc37ef2a9ee8042
Gerrit-Change-Number: 10456
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 15 Aug 2018 07:57:18 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmocom-bb[master]: trxcon/sched_prim.c: refactor prim dequeuing logic

2018-08-15 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/10454 )

Change subject: trxcon/sched_prim.c: refactor prim dequeuing logic
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib82ad2480ab1bc6b1df9576eb2bf5acbd398bf66
Gerrit-Change-Number: 10454
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 15 Aug 2018 07:56:54 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmocom-bb[master]: trxcon/sched_prim.c: properly handle both TCH/H and FACCH/H prims

2018-08-15 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/10455 )

Change subject: trxcon/sched_prim.c: properly handle both TCH/H and FACCH/H 
prims
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I9b59f60e1cbac8fb8fd557b6c67b5e376c0a6bbb
Gerrit-Change-Number: 10455
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 15 Aug 2018 07:56:29 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmocom-bb[master]: trxcon/sched_trx.h: add missing parentheses to PRIM_IS_*

2018-08-15 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/10453 )

Change subject: trxcon/sched_trx.h: add missing parentheses to PRIM_IS_*
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ifa7d9f806b3f18f2dfec931252f5119441b30e8a
Gerrit-Change-Number: 10453
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 15 Aug 2018 07:56:39 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes