Build failure of network:osmocom:nightly/osmo-trx in Debian_Testing/x86_64

2019-10-07 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-trx/Debian_Testing/x86_64

Package network:osmocom:nightly/osmo-trx failed to build in 
Debian_Testing/x86_64

Check out the package for editing:
  osc checkout network:osmocom:nightly osmo-trx

Last lines of build log:
[  497s] ar: `u' modifier ignored since `D' is the default (see `U')
[  497s] libtool: link: ranlib .libs/libtransceiver_common.a
[  497s] libtool: link: ( cd ".libs" && rm -f "libtransceiver_common.la" && ln 
-s "../libtransceiver_common.la" "libtransceiver_common.la" )
[  497s] /bin/bash ../libtool  --tag=CXX   --mode=link g++ -lpthread 
-I/usr/include/ -I/usr/include/ -I/usr/include/ -g -O2 
-fdebug-prefix-map=/usr/src/packages/BUILD=. -fstack-protector-strong -Wformat 
-Werror=format-security  -Wl,-z,relro -Wl,-z,now -o osmo-trx-uhd 
osmo_trx_uhd-osmo-trx.o ./device/uhd/libdevice.la libtransceiver_common.la 
../Transceiver52M/arch/x86/libarch.la ../GSM/libGSM.la 
../CommonLibs/libcommon.la -lfftw3f -ltalloc -losmocore -ltalloc -losmoctrl 
-losmogsm -losmocore -ltalloc -losmovty -losmocore -luhd 
[  498s] libtool: link: g++ -I/usr/include/ -I/usr/include/ -I/usr/include/ -g 
-O2 -fdebug-prefix-map=/usr/src/packages/BUILD=. -fstack-protector-strong 
-Wformat -Werror=format-security -Wl,-z -Wl,relro -Wl,-z -Wl,now -o 
osmo-trx-uhd osmo_trx_uhd-osmo-trx.o  ./device/uhd/.libs/libdevice.a 
./.libs/libtransceiver_common.a ../Transceiver52M/arch/x86/.libs/libarch.a 
../GSM/.libs/libGSM.a ../CommonLibs/.libs/libcommon.a -lpthread -lfftw3f 
/usr/lib/x86_64-linux-gnu/libosmoctrl.so 
/usr/lib/x86_64-linux-gnu/libosmogsm.so -ltalloc 
/usr/lib/x86_64-linux-gnu/libosmovty.so 
/usr/lib/x86_64-linux-gnu/libosmocore.so -luhd
[  498s] /usr/bin/ld: ./device/uhd/.libs/libdevice.a(UHDDevice.o): undefined 
reference to symbol '_ZN5boost6system16generic_categoryEv'
[  498s] /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_system.so.1.67.0: 
error adding symbols: DSO missing from command line
[  498s] collect2: error: ld returned 1 exit status
[  498s] make[4]: *** [Makefile:681: osmo-trx-uhd] Error 1
[  498s] make[4]: Leaving directory '/usr/src/packages/BUILD/Transceiver52M'
[  498s] make[3]: *** [Makefile:820: all-recursive] Error 1
[  498s] make[3]: Leaving directory '/usr/src/packages/BUILD/Transceiver52M'
[  498s] make[2]: *** [Makefile:513: all-recursive] Error 1
[  498s] make[2]: Leaving directory '/usr/src/packages/BUILD'
[  498s] make[1]: *** [Makefile:444: all] Error 2
[  498s] make[1]: Leaving directory '/usr/src/packages/BUILD'
[  498s] dh_auto_build: make -j1 returned exit code 2
[  498s] make: *** [debian/rules:6: build] Error 255
[  498s] dpkg-buildpackage: error: debian/rules build subprocess returned exit 
status 2
[  498s] 
[  498s] lamb10 failed "build osmo-trx_1.1.1.30.92814.dsc" at Tue Oct  8 
04:27:23 UTC 2019.
[  498s] 
[  498s] ### VM INTERACTION START ###
[  501s] [  480.326732] sysrq: SysRq : Power Off
[  501s] [  480.366360] reboot: Power down
[  501s] ### VM INTERACTION END ###
[  501s] 
[  501s] lamb10 failed "build osmo-trx_1.1.1.30.92814.dsc" at Tue Oct  8 
04:27:27 UTC 2019.
[  501s] 

-- 
Configure notifications at https://build.opensuse.org/my/notifications
openSUSE Build Service (https://build.opensuse.org/)


Build failure of network:osmocom:nightly/osmo-trx in Debian_Testing/x86_64

2019-10-07 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-trx/Debian_Testing/x86_64

Package network:osmocom:nightly/osmo-trx failed to build in 
Debian_Testing/x86_64

Check out the package for editing:
  osc checkout network:osmocom:nightly osmo-trx

Last lines of build log:
[  539s] ar: `u' modifier ignored since `D' is the default (see `U')
[  539s] libtool: link: ranlib .libs/libtransceiver_common.a
[  539s] libtool: link: ( cd ".libs" && rm -f "libtransceiver_common.la" && ln 
-s "../libtransceiver_common.la" "libtransceiver_common.la" )
[  539s] /bin/bash ../libtool  --tag=CXX   --mode=link g++ -lpthread 
-I/usr/include/ -I/usr/include/ -I/usr/include/ -g -O2 
-fdebug-prefix-map=/usr/src/packages/BUILD=. -fstack-protector-strong -Wformat 
-Werror=format-security  -Wl,-z,relro -Wl,-z,now -o osmo-trx-uhd 
osmo_trx_uhd-osmo-trx.o ./device/uhd/libdevice.la libtransceiver_common.la 
../Transceiver52M/arch/x86/libarch.la ../GSM/libGSM.la 
../CommonLibs/libcommon.la -lfftw3f -ltalloc -losmocore -ltalloc -losmoctrl 
-losmogsm -losmocore -ltalloc -losmovty -losmocore -luhd 
[  540s] libtool: link: g++ -I/usr/include/ -I/usr/include/ -I/usr/include/ -g 
-O2 -fdebug-prefix-map=/usr/src/packages/BUILD=. -fstack-protector-strong 
-Wformat -Werror=format-security -Wl,-z -Wl,relro -Wl,-z -Wl,now -o 
osmo-trx-uhd osmo_trx_uhd-osmo-trx.o  ./device/uhd/.libs/libdevice.a 
./.libs/libtransceiver_common.a ../Transceiver52M/arch/x86/.libs/libarch.a 
../GSM/.libs/libGSM.a ../CommonLibs/.libs/libcommon.a -lpthread -lfftw3f 
/usr/lib/x86_64-linux-gnu/libosmoctrl.so 
/usr/lib/x86_64-linux-gnu/libosmogsm.so -ltalloc 
/usr/lib/x86_64-linux-gnu/libosmovty.so 
/usr/lib/x86_64-linux-gnu/libosmocore.so -luhd
[  540s] /usr/bin/ld: ./device/uhd/.libs/libdevice.a(UHDDevice.o): undefined 
reference to symbol '_ZN5boost6system16generic_categoryEv'
[  540s] /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_system.so.1.67.0: 
error adding symbols: DSO missing from command line
[  540s] collect2: error: ld returned 1 exit status
[  540s] make[4]: *** [Makefile:681: osmo-trx-uhd] Error 1
[  540s] make[4]: Leaving directory '/usr/src/packages/BUILD/Transceiver52M'
[  540s] make[3]: *** [Makefile:820: all-recursive] Error 1
[  540s] make[3]: Leaving directory '/usr/src/packages/BUILD/Transceiver52M'
[  540s] make[2]: *** [Makefile:513: all-recursive] Error 1
[  540s] make[2]: Leaving directory '/usr/src/packages/BUILD'
[  540s] make[1]: *** [Makefile:444: all] Error 2
[  540s] make[1]: Leaving directory '/usr/src/packages/BUILD'
[  540s] dh_auto_build: make -j1 returned exit code 2
[  540s] make: *** [debian/rules:6: build] Error 255
[  540s] dpkg-buildpackage: error: debian/rules build subprocess returned exit 
status 2
[  540s] 
[  540s] morla3 failed "build osmo-trx_1.1.1.30.92814.dsc" at Tue Oct  8 
02:40:28 UTC 2019.
[  540s] 
[  540s] ### VM INTERACTION START ###
[  543s] [  517.978039] sysrq: SysRq : Power Off
[  543s] [  518.062984] reboot: Power down
[  543s] ### VM INTERACTION END ###
[  543s] 
[  543s] morla3 failed "build osmo-trx_1.1.1.30.92814.dsc" at Tue Oct  8 
02:40:31 UTC 2019.
[  543s] 

-- 
Configure notifications at https://build.opensuse.org/my/notifications
openSUSE Build Service (https://build.opensuse.org/)


Change in ...osmo-ccid-firmware[master]: SRAM linker script: shift start of RAM by 64kByte

2019-10-07 Thread laforge
Hello Hoernchen,

I'd like you to do a code review. Please visit

https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/15688

to review the following change.


Change subject: SRAM linker script: shift start of RAM by 64kByte
..

SRAM linker script: shift start of RAM by 64kByte

Change-Id: I69ed656ac7007c5b8aa08c18569a7da5fe6ef277
FIXME: Why?
---
M sysmoOCTSIM/gcc/gcc/same54n19a_sram.ld
1 file changed, 1 insertion(+), 1 deletion(-)



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

diff --git a/sysmoOCTSIM/gcc/gcc/same54n19a_sram.ld 
b/sysmoOCTSIM/gcc/gcc/same54n19a_sram.ld
index c770c7c..13faee2 100644
--- a/sysmoOCTSIM/gcc/gcc/same54n19a_sram.ld
+++ b/sysmoOCTSIM/gcc/gcc/same54n19a_sram.ld
@@ -35,7 +35,7 @@
 /* Memory Spaces Definitions */
 MEMORY
 {
-  ram  (rwx) : ORIGIN = 0x2000, LENGTH = 0x0003
+  ram  (rwx) : ORIGIN = 0x2000+ 0x0001, LENGTH = 0x0002
   bkupram  (rwx) : ORIGIN = 0x4700, LENGTH = 0x2000
   qspi (rwx) : ORIGIN = 0x0400, LENGTH = 0x0100
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/15688
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-Change-Id: I69ed656ac7007c5b8aa08c18569a7da5fe6ef277
Gerrit-Change-Number: 15688
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-Reviewer: Hoernchen 
Gerrit-MessageType: newchange


Change in ...osmo-ccid-firmware[master]: iso7816_fsm: Implement single-byte RX/TX

2019-10-07 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/15697


Change subject: iso7816_fsm: Implement single-byte RX/TX
..

iso7816_fsm: Implement single-byte RX/TX

Change-Id: I31fb127e1cb2fda0856658a6511089c3d9e31c2a
---
M ccid/iso7816_fsm.c
1 file changed, 52 insertions(+), 17 deletions(-)



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

diff --git a/ccid/iso7816_fsm.c b/ccid/iso7816_fsm.c
index f20cbcd..e173030 100644
--- a/ccid/iso7816_fsm.c
+++ b/ccid/iso7816_fsm.c
@@ -779,8 +779,22 @@
  * TPDU FSM
  ***/

+/* In this FSM weu use the msgb for the TPDU as follows:
+ *  - 5-byte TPDU header is at msg->data
+ *  - COMMAND TPDU:
+ *- command bytes are provided after the header at msg->l2h
+ *- in case of incremental transmission, l3h points to next 
to-be-transmitted byte
+ *  - RESPONSE TPDU:
+ *- any response bytes are stored after the header at msg->l2h
+ */
+
+static inline struct osim_apdu_cmd_hdr *msgb_tpdu_hdr(struct msgb *msg) {
+   return (struct osim_apdu_cmd_hdr *) msgb_data(msg);
+}
+
 struct tpdu_fsm_priv {
struct msgb *tpdu;
+   bool is_command; /* is this a command TPDU (true) or a response (false) 
*/
 };

 /* type-safe method to obtain iso7816_3_priv from fi */
@@ -805,8 +819,14 @@
tfp->tpdu = (struct msgb *)data;
OSMO_ASSERT(msgb_length(tfp->tpdu) >= sizeof(*tpduh));
tfp->tpdu->l2h = msgb_data(tfp->tpdu) + sizeof(*tpduh);
-   tpduh = msgb_data(tfp->tpdu);
-   LOGPFSML(fi, LOGL_DEBUG, "Transmitting TPDU header %s via 
UART\n",
+   if (msgb_l2len(tfp->tpdu)) {
+   tfp->is_command = true;
+   tfp->tpdu->l3h = tfp->tpdu->l2h; /* next tx byte == 
first byte of body */
+   } else
+   tfp->is_command = false;
+   tpduh = msgb_tpdu_hdr(tfp->tpdu);
+   LOGPFSML(fi, LOGL_DEBUG, "Transmitting %s TPDU header %s via 
UART\n",
+tfp->is_command ? "COMMAND" : "RESPONSE",
 osmo_hexdump_nospc((uint8_t *) tpduh, sizeof(*tpduh)));
osmo_fsm_inst_state_chg(fi, TPDU_S_TX_HDR, 0, 0);
card_uart_tx(ip->uart, (uint8_t *) tpduh, sizeof(*tpduh));
@@ -834,7 +854,7 @@
 static void tpdu_s_procedure_action(struct osmo_fsm_inst *fi, uint32_t event, 
void *data)
 {
struct tpdu_fsm_priv *tfp = get_tpdu_fsm_priv(fi);
-   struct osim_apdu_cmd_hdr *tpduh = msgb_data(tfp->tpdu);
+   struct osim_apdu_cmd_hdr *tpduh = msgb_tpdu_hdr(tfp->tpdu);
struct osmo_fsm_inst *parent_fi = fi->proc.parent;
struct iso7816_3_priv *ip = get_iso7816_3_priv(parent_fi);
uint8_t byte;
@@ -853,7 +873,7 @@
osmo_fsm_inst_state_chg(fi, TPDU_S_SW2, 0, 0);
break;
} else if (byte == tpduh->ins) {
-   if (msgb_l2len(tfp->tpdu)) {
+   if (tfp->is_command) {
/* transmit all remaining bytes */
card_uart_tx(ip->uart, msgb_l2(tfp->tpdu), 
msgb_l2len(tfp->tpdu));
osmo_fsm_inst_state_chg(fi, 
TPDU_S_TX_REMAINING, 0, 0);
@@ -862,10 +882,15 @@
osmo_fsm_inst_state_chg(fi, 
TPDU_S_RX_REMAINING, 0, 0);
}
} else if (byte == (tpduh->ins ^ 0xFF)) {
-   osmo_panic("unsupported single-byte T=0 case");
-   /* FIXME: transmit single byte then wait for proc */
-   //osmo_fsm_inst_state_chg(fi, TPDU_S_xX_SINGLE, 0, 0);
-   //osmo_fsm_inst_state_chg(fi, TPDU_S_PROCEDURE, 0, 0);
+   /* transmit/recieve single byte then wait for proc */
+   if (tfp->is_command) {
+   /* transmit *next*, not first byte */
+   OSMO_ASSERT(msgb_l3len(tfp->tpdu) >= 0);
+   card_uart_tx(ip->uart, msgb_l3(tfp->tpdu), 1);
+   osmo_fsm_inst_state_chg(fi, TPDU_S_TX_SINGLE, 
0, 0);
+   } else {
+   osmo_fsm_inst_state_chg(fi, TPDU_S_RX_SINGLE, 
0, 0);
+   }
} else
OSMO_ASSERT(0);
break;
@@ -893,10 +918,15 @@
 /* UART is transmitting single byte of data; we wait for ISO7816_E_TX_COMPL */
 static void tpdu_s_tx_single_action(struct osmo_fsm_inst *fi, uint32_t event, 
void *data)
 {
+   struct tpdu_fsm_priv *tfp = get_tpdu_fsm_priv(fi);
+
switch (event) {
case ISO7816_E_TX_COMPL:
-   /* TODO: increase pointer/counter? */
- 

Change in ...osmo-ccid-firmware[master]: WIP: change IRQ endpoint re-submit logic.

2019-10-07 Thread laforge
Hello Hoernchen,

I'd like you to do a code review. Please visit

https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/15689

to review the following change.


Change subject: WIP: change IRQ endpoint re-submit logic.
..

WIP: change IRQ endpoint re-submit logic.

Why?

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



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

diff --git a/sysmoOCTSIM/main.c b/sysmoOCTSIM/main.c
index 9ef7f2f..6e2d6ac 100644
--- a/sysmoOCTSIM/main.c
+++ b/sysmoOCTSIM/main.c
@@ -220,7 +220,9 @@
struct msgb *msg;
int rc;

-   OSMO_ASSERT(!ep_q->in_progress);
+   if (ep_q->in_progress)
+   return 0;
+
msg = msgb_dequeue_irqsafe(_q->list);
if (!msg)
return 0;
@@ -1110,6 +1112,7 @@
while (true) { // main loop
command_try_recv();
poll_card_detect();
+   submit_next_irq();
osmo_timers_update();
}
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/15689
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-Change-Id: I41e77eec5f01bf082f8cb7331fbf7baae1c132ed
Gerrit-Change-Number: 15689
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-Reviewer: Hoernchen 
Gerrit-MessageType: newchange


Change in ...osmo-ccid-firmware[master]: 'cuart' Card-UART abstraction + driver for simple serial reader

2019-10-07 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/15691


Change subject: 'cuart' Card-UART abstraction + driver for simple serial reader
..

'cuart' Card-UART abstraction + driver for simple serial reader

Change-Id: Ic7e324d99f78b3bfb98fc667d9a1b7fa363f092d
---
M ccid/Makefile
A ccid/cuart.c
A ccid/cuart.h
A ccid/cuart_driver_tty.c
A ccid/cuart_test.c
A ccid/utils_ringbuffer.c
A ccid/utils_ringbuffer.h
7 files changed, 833 insertions(+), 1 deletion(-)



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

diff --git a/ccid/Makefile b/ccid/Makefile
index 5f784ba..a0d6952 100644
--- a/ccid/Makefile
+++ b/ccid/Makefile
@@ -1,13 +1,18 @@
 CFLAGS=-Wall -g

+all: ccid_functionfs hub_functionfs cuart_test
+
 ccid_functionfs: ccid_main_functionfs.o logging.o ccid_proto.o ccid_device.o 
ccid_slot_sim.o
$(CC) $(CFLAGS) -o $@ $^ -lasan -losmocore -ltalloc -laio

 hub_functionfs: hub_main_functionfs.o
$(CC) $(CFLAGS) -o $@ $^ -lasan -losmocore -ltalloc -laio

+cuart_test: cuart_test.o cuart.o cuart_driver_tty.o utils_ringbuffer.o
+   $(CC) $(CFLAGS) -o $@ $^ -lasan -losmocore -ltalloc
+
 %.o: %.c
$(CC) $(CFLAGS) -o $@ -c $^

 clean:
-   rm ccid_functionfs *.o
+   rm ccid_functionfs hub_functionfs cuart_test *.o
diff --git a/ccid/cuart.c b/ccid/cuart.c
new file mode 100644
index 000..2c0428e
--- /dev/null
+++ b/ccid/cuart.c
@@ -0,0 +1,133 @@
+#include 
+#include 
+#include 
+#include 
+
+#include "cuart.h"
+
+static LLIST_HEAD(g_cuart_drivers);
+
+const struct value_string card_uart_event_vals[] = {
+   OSMO_VALUE_STRING(CUART_E_RX_SINGLE),
+   OSMO_VALUE_STRING(CUART_E_RX_COMPLETE),
+   OSMO_VALUE_STRING(CUART_E_RX_TIMEOUT),
+   OSMO_VALUE_STRING(CUART_E_TX_COMPLETE),
+   { 0, NULL }
+};
+
+static struct card_uart_driver *cuart_drv_by_name(const char *driver_name)
+{
+   struct card_uart_driver *drv;
+   llist_for_each_entry(drv, _cuart_drivers, list) {
+   if (!strcmp(drv->name, driver_name))
+   return drv;
+   }
+   return NULL;
+}
+
+int card_uart_open(struct card_uart *cuart, const char *driver_name, const 
char *device_name)
+{
+   struct card_uart_driver *drv = cuart_drv_by_name(driver_name);
+   int rc;
+
+   if (!drv)
+   return -ENODEV;
+
+   cuart->rx_enabled = true;
+   cuart->rx_threshold = 1;
+
+   rc = drv->ops->open(cuart, device_name);
+   if (rc < 0)
+   return rc;
+
+   cuart->driver = drv;
+   return 0;
+}
+
+int card_uart_close(struct card_uart *cuart)
+{
+   OSMO_ASSERT(cuart);
+   OSMO_ASSERT(cuart->driver);
+   OSMO_ASSERT(cuart->driver->ops);
+   OSMO_ASSERT(cuart->driver->ops->close);
+   return cuart->driver->ops->close(cuart);
+}
+
+int card_uart_ctrl(struct card_uart *cuart, enum card_uart_ctl ctl, bool 
enable)
+{
+   int rc;
+   OSMO_ASSERT(cuart);
+   OSMO_ASSERT(cuart->driver);
+   OSMO_ASSERT(cuart->driver->ops);
+   OSMO_ASSERT(cuart->driver->ops->ctrl);
+   rc = cuart->driver->ops->ctrl(cuart, ctl, enable);
+   if (rc < 0)
+   return rc;
+
+   switch (ctl) {
+   case CUART_CTL_RX:
+   cuart->rx_enabled = enable;
+   break;
+   default:
+   break;
+   }
+
+   return rc;
+}
+
+int card_uart_tx(struct card_uart *cuart, const uint8_t *data, size_t len, 
bool rx_after_complete)
+{
+   OSMO_ASSERT(cuart);
+   OSMO_ASSERT(cuart->driver);
+   OSMO_ASSERT(cuart->driver->ops);
+   OSMO_ASSERT(cuart->driver->ops->async_tx);
+
+   OSMO_ASSERT(!cuart->tx_busy);
+   cuart->tx_busy = true;
+   /* disable receiver to avoid receiving what we transmit */
+   card_uart_ctrl(cuart, CUART_CTL_RX, false);
+
+   return cuart->driver->ops->async_tx(cuart, data, len, 
rx_after_complete);
+}
+
+int card_uart_rx(struct card_uart *cuart, uint8_t *data, size_t len)
+{
+   OSMO_ASSERT(cuart);
+   OSMO_ASSERT(cuart->driver);
+   OSMO_ASSERT(cuart->driver->ops);
+   OSMO_ASSERT(cuart->driver->ops->async_rx);
+   return cuart->driver->ops->async_rx(cuart, data, len);
+}
+
+void card_uart_set_rx_threshold(struct card_uart *cuart, size_t rx_threshold)
+{
+   cuart->rx_threshold = rx_threshold;
+}
+
+void card_uart_notification(struct card_uart *cuart, enum card_uart_event evt, 
void *data)
+{
+   OSMO_ASSERT(cuart);
+   OSMO_ASSERT(cuart->handle_event);
+
+   switch (evt) {
+   case CUART_E_TX_COMPLETE:
+   cuart->tx_busy = false;
+   /* re-enable receiver if we're done with transmit */
+   sleep(1);
+   card_uart_ctrl(cuart, CUART_CTL_RX, true);
+   break;
+   default:
+   break;
+   }
+
+   cuart->handle_event(cuart, evt, data);

Change in ...osmo-ccid-firmware[master]: make ccid_main_functionfs use iso7816_fsm and cuart_driver_tty

2019-10-07 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/15695


Change subject: make ccid_main_functionfs use iso7816_fsm and cuart_driver_tty
..

make ccid_main_functionfs use iso7816_fsm and cuart_driver_tty

This works up to the point that we're getting the ATR displayed in
pcsc_scan

Change-Id: Ic656fff4a9c6b9aaf4b91aa16f66972ad28f8423
---
M ccid/Makefile
M ccid/ccid_main_functionfs.c
A ccid/ccid_slot_fsm.c
3 files changed, 215 insertions(+), 2 deletions(-)



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

diff --git a/ccid/Makefile b/ccid/Makefile
index 3ab1045..4993550 100644
--- a/ccid/Makefile
+++ b/ccid/Makefile
@@ -3,7 +3,9 @@

 all: ccid_functionfs hub_functionfs cuart_test cuart_fsm_test

-ccid_functionfs: ccid_main_functionfs.o logging.o ccid_proto.o ccid_device.o 
ccid_slot_sim.o
+ccid_functionfs: ccid_main_functionfs.o logging.o ccid_proto.o ccid_device.o \
+cuart.o utils_ringbuffer.o cuart_driver_tty.o \
+ccid_slot_fsm.o iso7816_fsm.o
$(CC) $(CFLAGS) -o $@ $^ $(LIBS) -laio
 
 hub_functionfs: hub_main_functionfs.o
diff --git a/ccid/ccid_main_functionfs.c b/ccid/ccid_main_functionfs.c
index 5c0bc3b..d45a936 100644
--- a/ccid/ccid_main_functionfs.c
+++ b/ccid/ccid_main_functionfs.c
@@ -152,6 +152,7 @@

 #include "ccid_device.h"
 #include "ccid_slot_sim.h"
+extern struct ccid_slot_ops iso_fsm_slot_ops;

 #ifndef FUNCTIONFS_SUPPORTS_POLL
 #include 
@@ -528,7 +529,7 @@

signal(SIGUSR1, _handler);

-   ccid_instance_init(_ci, _ops, _slot_ops, 
_descs.ccid,
+   ccid_instance_init(_ci, _ops, _fsm_slot_ops, 
_descs.ccid,
   data_rates, clock_freqs, "", );
ufh.ccid_handle = _ci;

diff --git a/ccid/ccid_slot_fsm.c b/ccid/ccid_slot_fsm.c
new file mode 100644
index 000..06c14f1
--- /dev/null
+++ b/ccid/ccid_slot_fsm.c
@@ -0,0 +1,210 @@
+/* Code providing a ccid_slot_ops implementation based on iso7716_fsm,
+ * (which in turn sits on top of card_uart) */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "ccid_device.h"
+#include "cuart.h"
+#include "iso7816_fsm.h"
+
+struct iso_fsm_slot {
+   /* CCID slot above us */
+   struct ccid_slot *cs;
+   /* main ISO7816-3 FSM instance beneath us */
+   struct osmo_fsm_inst *fi;
+   /* UART beneath the ISO7816-3 FSM */
+   struct card_uart *cuart;
+   /* bSeq of the operation currently in progress */
+   uint8_t seq;
+};
+
+struct iso_fsm_slot_instance {
+   struct iso_fsm_slot slot[NR_SLOTS];
+};
+
+static struct iso_fsm_slot_instance g_si;
+
+struct iso_fsm_slot *ccid_slot2iso_fsm_slot(struct ccid_slot *cs)
+{
+   OSMO_ASSERT(cs->slot_nr < ARRAY_SIZE(g_si.slot));
+   return _si.slot[cs->slot_nr];
+}
+
+static const uint8_t sysmousim_sjs1_atr[] = {
+   0x3B, 0x9F, 0x96, 0x80, 0x1F, 0xC7, 0x80, 0x31,
+   0xA0, 0x73, 0xBE, 0x21, 0x13, 0x67, 0x43, 0x20,
+   0x07, 0x18, 0x00, 0x00, 0x01, 0xA5 };
+
+static const struct ccid_pars_decoded iso_fsm_def_pars = {
+   .fi = 372,
+   .di = 1,
+   .clock_stop = CCID_CLOCK_STOP_NOTALLOWED,
+   .inverse_convention = false,
+   .t0 = {
+   .guard_time_etu = 0,
+   .waiting_integer = 0,
+   },
+   /* FIXME: T=1 */
+};
+
+static void iso_fsm_slot_pre_proc_cb(struct ccid_slot *cs, struct msgb *msg)
+{
+   /* do nothing; real hardware would update the slot related state here */
+}
+
+static void iso_fsm_slot_icc_power_on_async(struct ccid_slot *cs, struct msgb 
*msg,
+   const struct 
ccid_pc_to_rdr_icc_power_on *ipo)
+{
+   struct iso_fsm_slot *ss = ccid_slot2iso_fsm_slot(cs);
+
+   ss->seq = ipo->hdr.bSeq;
+   LOGPCS(cs, LOGL_DEBUG, "scheduling power-up\n");
+
+   /* FIXME: do this via a FSM? */
+   card_uart_ctrl(ss->cuart, CUART_CTL_RST, true);
+   card_uart_ctrl(ss->cuart, CUART_CTL_POWER, true);
+   osmo_fsm_inst_dispatch(ss->fi, ISO7816_E_POWER_UP_IND, NULL);
+   cs->icc_powered = true;
+   card_uart_ctrl(ss->cuart, CUART_CTL_CLOCK, true);
+   usleep(1);
+   card_uart_ctrl(ss->cuart, CUART_CTL_RST, false);
+   osmo_fsm_inst_dispatch(ss->fi, ISO7816_E_RESET_REL_IND, NULL);
+
+   msgb_free(msg);
+   /* continues in iso_fsm_clot_user_cb once ATR is received */
+}
+static void iso_fsm_clot_user_cb(struct osmo_fsm_inst *fi, int event, int 
cause, void *data)
+{
+   struct iso_fsm_slot *ss = iso7816_fsm_get_user_priv(fi);
+   struct ccid_slot *cs = ss->cs;
+   struct msgb *tpdu, *resp;
+
+   LOGPCS(cs, LOGL_DEBUG, "%s(event=%d, cause=%d, data=%p)\n", __func__, 
event, cause, data);
+
+   switch (event) {
+   case ISO7816_E_ATR_DONE_IND:
+   tpdu = data;
+   /* FIXME: copy response data 

Change in ...osmo-ccid-firmware[master]: add .gitignore file

2019-10-07 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/15693


Change subject: add .gitignore file
..

add .gitignore file

Change-Id: Iecd6caa00abf79f58199a8168aa8a1d3f5c9cf0a
---
A .gitignore
1 file changed, 4 insertions(+), 0 deletions(-)



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

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000..76313c1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*.o
+ccid/ccid_functionfs
+ccid/cuart_test
+ccid/hub_functionfs

--
To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/15693
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-Change-Id: Iecd6caa00abf79f58199a8168aa8a1d3f5c9cf0a
Gerrit-Change-Number: 15693
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-MessageType: newchange


Change in ...osmo-ccid-firmware[master]: cuart_driver_tty: Work around linux kernel bug ignoring CREAD

2019-10-07 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/15692


Change subject: cuart_driver_tty: Work around linux kernel bug ignoring CREAD
..

cuart_driver_tty: Work around linux kernel bug ignoring CREAD

Almost all linux USB serial drivers are ignoring CREAD and hence
cannot disable the receiver hardware, see 
https://bugzilla.kernel.org/show_bug.cgi?id=205033

We therefore have to receive every byte we transmit before notifying the
user of transmit completion.

Change-Id: Id3cca29f78ee5469a1142aaa1ff754cc0427ec93
---
M ccid/cuart.c
M ccid/cuart.h
M ccid/cuart_driver_tty.c
M ccid/cuart_test.c
4 files changed, 24 insertions(+), 4 deletions(-)



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

diff --git a/ccid/cuart.c b/ccid/cuart.c
index 2c0428e..393bf55 100644
--- a/ccid/cuart.c
+++ b/ccid/cuart.c
@@ -113,7 +113,6 @@
case CUART_E_TX_COMPLETE:
cuart->tx_busy = false;
/* re-enable receiver if we're done with transmit */
-   sleep(1);
card_uart_ctrl(cuart, CUART_CTL_RX, true);
break;
default:
diff --git a/ccid/cuart.h b/ccid/cuart.h
index 7e217db..c28209f 100644
--- a/ccid/cuart.h
+++ b/ccid/cuart.h
@@ -77,6 +77,8 @@
size_t tx_buf_len;
/* index: offset of next to be transmitted byte in 
tx_buf */
size_t tx_index;
+   /* number of bytes we have received echoed back during 
transmit */
+   uint32_t rx_count_during_tx;

struct osmo_fd ofd;
unsigned int baudrate;
@@ -104,4 +106,3 @@
 void card_uart_notification(struct card_uart *cuart, enum card_uart_event evt, 
void *data);

 int card_uart_driver_register(struct card_uart_driver *drv);
-
diff --git a/ccid/cuart_driver_tty.c b/ccid/cuart_driver_tty.c
index 6bd2b52..7fc8d3a 100644
--- a/ccid/cuart_driver_tty.c
+++ b/ccid/cuart_driver_tty.c
@@ -125,7 +125,21 @@
rc = read(ofd->fd, buf, sizeof(buf));
OSMO_ASSERT(rc > 0);
for (i = 0; i < rc; i++) {
+#ifndef CREAD_ACTUALLY_WORKS
/* work-around for 
https://bugzilla.kernel.org/show_bug.cgi?id=205033 */
+   if (cuart->tx_busy) {
+   if (cuart->u.tty.rx_count_during_tx < 
cuart->u.tty.tx_buf_len) {
+   /* FIXME: compare! */
+   cuart->u.tty.rx_count_during_tx += 1;
+   if (cuart->u.tty.rx_count_during_tx == 
cuart->u.tty.tx_buf_len) {
+   cuart->tx_busy = false;
+   card_uart_notification(cuart, 
CUART_E_TX_COMPLETE,
+   (void 
*)cuart->u.tty.tx_buf);
+   }
+   continue;
+   }
+   }
+#endif
if (!cuart->rx_enabled)
continue;

@@ -152,12 +166,15 @@
/* if no more bytes to transmit, disable OSMO_FD_WRITE */
if (cuart->u.tty.tx_index >= cuart->u.tty.tx_buf_len) {
ofd->when &= ~BSC_FD_WRITE;
+#ifndef CREAD_ACTUALLY_WORKS
+   /* don't immediately notify user; first wait for 
characters to be received */
+#else
/* ensure everything is written (tx queue/fifo drained) 
*/
tcdrain(cuart->u.tty.ofd.fd);
-   osmo_select_main(true);
cuart->tx_busy = false;
/* notify */
card_uart_notification(cuart, CUART_E_TX_COMPLETE, 
(void *)cuart->u.tty.tx_buf);
+#endif
}
}
return 0;
@@ -209,7 +226,8 @@

cuart->u.tty.tx_buf = data;
cuart->u.tty.tx_buf_len = len;
-   cuart->u.tty.tx_buf_len = len;
+   cuart->u.tty.tx_index = 0;
+   cuart->u.tty.rx_count_during_tx = 0;
cuart->tx_busy = true;
cuart->u.tty.ofd.when |= OSMO_FD_WRITE;

diff --git a/ccid/cuart_test.c b/ccid/cuart_test.c
index aff9de7..0ed6614 100644
--- a/ccid/cuart_test.c
+++ b/ccid/cuart_test.c
@@ -47,6 +47,8 @@
card_uart_tx(_cuart, select_mf, 5, true);

osmo_select_main(true);
+   sleep(1);
+   osmo_select_main(true);
/* we should get an RX_SINGLE event here */
 }


--
To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/15692
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-Change-Id: 

Change in ...osmo-ccid-firmware[master]: Make cuart_fsm_test work (ATR + TPDU)

2019-10-07 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/15694


Change subject: Make cuart_fsm_test work (ATR + TPDU)
..

Make cuart_fsm_test work (ATR + TPDU)

Change-Id: I5abfe18a414feac6d66f7e506865dd4cd5af73fe
---
M ccid/Makefile
A ccid/cuart_fsm_test.c
2 files changed, 121 insertions(+), 5 deletions(-)



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

diff --git a/ccid/Makefile b/ccid/Makefile
index a0d6952..3ab1045 100644
--- a/ccid/Makefile
+++ b/ccid/Makefile
@@ -1,18 +1,22 @@
 CFLAGS=-Wall -g
+LIBS?=-lasan $(shell pkg-config --libs libosmocore)

-all: ccid_functionfs hub_functionfs cuart_test
+all: ccid_functionfs hub_functionfs cuart_test cuart_fsm_test

 ccid_functionfs: ccid_main_functionfs.o logging.o ccid_proto.o ccid_device.o 
ccid_slot_sim.o
-   $(CC) $(CFLAGS) -o $@ $^ -lasan -losmocore -ltalloc -laio
+   $(CC) $(CFLAGS) -o $@ $^ $(LIBS) -laio

 hub_functionfs: hub_main_functionfs.o
-   $(CC) $(CFLAGS) -o $@ $^ -lasan -losmocore -ltalloc -laio
+   $(CC) $(CFLAGS) -o $@ $^ $(LIBS) -laio

 cuart_test: cuart_test.o cuart.o cuart_driver_tty.o utils_ringbuffer.o
-   $(CC) $(CFLAGS) -o $@ $^ -lasan -losmocore -ltalloc
+   $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
+
+cuart_fsm_test: cuart_fsm_test.o logging.o cuart.o cuart_driver_tty.o 
utils_ringbuffer.o iso7816_fsm.o
+   $(CC) -o $@ $^ $(LIBS) $(shell pkg-config --libs libosmosim)

 %.o: %.c
$(CC) $(CFLAGS) -o $@ -c $^

 clean:
-   rm ccid_functionfs hub_functionfs cuart_test *.o
+   rm ccid_functionfs hub_functionfs cuart_test cuart_fsm_test *.o
diff --git a/ccid/cuart_fsm_test.c b/ccid/cuart_fsm_test.c
new file mode 100644
index 000..92f3437
--- /dev/null
+++ b/ccid/cuart_fsm_test.c
@@ -0,0 +1,112 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "logging.h"
+#include "cuart.h"
+#include "iso7816_fsm.h"
+
+static struct card_uart g_cuart;
+
+enum test_state {
+   ST_WAIT_ATR,
+   ST_ATR_DONE,
+   ST_IN_TPDU,
+};
+static enum test_state g_tstate = ST_WAIT_ATR;
+
+static void fsm_user_cb(struct osmo_fsm_inst *fi, int event, int cause, void 
*data)
+{
+   printf("Handle FSM User Event %d: cause=%d, data=%p\n", event, cause, 
data);
+   switch (event) {
+   case ISO7816_E_ATR_DONE_IND:
+   g_tstate = ST_ATR_DONE;
+   break;
+   case ISO7816_E_TPDU_DONE_IND:
+   printf("=== TPDU: %s\n", msgb_hexdump(data));
+   msgb_free(data);
+   g_tstate = ST_ATR_DONE;
+   default:
+   break;
+   }
+}
+
+static void *tall_main_ctx;
+
+static void signal_handler(int signal)
+{
+   switch (signal) {
+   case SIGUSR1:
+   talloc_report_full(tall_main_ctx, stderr);
+   break;
+   }
+}
+
+int main(int argc, char **argv)
+{
+   struct osmo_fsm_inst *fi;
+   uint8_t atr[64];
+   int rc;
+
+   tall_main_ctx = talloc_named_const(NULL, 0, "main");
+   msgb_talloc_ctx_init(tall_main_ctx, 0);
+   osmo_init_logging2(tall_main_ctx, _info);
+   osmo_fsm_log_addr(false);
+
+   signal(SIGUSR1, _handler);
+
+   rc = card_uart_open(_cuart, "tty", "/dev/ttyUSB5");
+   if (rc < 0) {
+   perror("opening UART");
+   exit(1);
+   }
+
+   fi = iso7816_fsm_alloc(NULL, LOGL_DEBUG, "SIM0", _cuart, fsm_user_cb, 
NULL);
+   OSMO_ASSERT(fi);
+
+   /* activate reset, then power up */
+   card_uart_ctrl(_cuart, CUART_CTL_RST, true);
+   card_uart_ctrl(_cuart, CUART_CTL_POWER, true);
+   osmo_fsm_inst_dispatch(fi, ISO7816_E_POWER_UP_IND, NULL);
+
+   /* activate clock */
+   card_uart_ctrl(_cuart, CUART_CTL_CLOCK, true);
+
+   /* wait some time and release reset */
+   usleep(1);
+   card_uart_ctrl(_cuart, CUART_CTL_RST, false);
+   osmo_fsm_inst_dispatch(fi, ISO7816_E_RESET_REL_IND, NULL);
+
+   /* process any events in polling mode for initial change */
+   osmo_select_main(1);
+
+   struct msgb *apdu;
+   while (1) {
+   /* check if the new state requires us to do something */
+   switch (g_tstate) {
+   case ST_ATR_DONE:
+   apdu = msgb_alloc(512, "TPDU");
+   msgb_put_u8(apdu, 0x00);
+   msgb_put_u8(apdu, 0xa4);
+   msgb_put_u8(apdu, 0x00);
+   msgb_put_u8(apdu, 0x04);
+   msgb_put_u8(apdu, 0x02);
+   msgb_put_u8(apdu, 0x2f);
+   msgb_put_u8(apdu, 0x00);
+   osmo_fsm_inst_dispatch(fi, ISO7816_E_XCEIVE_TPDU_CMD, 
apdu);
+   g_tstate = ST_IN_TPDU;
+   break;
+   default:
+   break;

Change in ...osmo-ccid-firmware[master]: card_uart_tx: Remove last argument (we always have the receiver active)

2019-10-07 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/15696


Change subject: card_uart_tx: Remove last argument (we always have the receiver 
active)
..

card_uart_tx: Remove last argument (we always have the receiver active)

Change-Id: I8f82e9108d0eae86bbe4535403ccc680b7379a0e
---
M ccid/cuart.c
M ccid/cuart.h
M ccid/cuart_driver_tty.c
M ccid/cuart_test.c
M ccid/iso7816_fsm.c
5 files changed, 8 insertions(+), 8 deletions(-)



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

diff --git a/ccid/cuart.c b/ccid/cuart.c
index 393bf55..895717a 100644
--- a/ccid/cuart.c
+++ b/ccid/cuart.c
@@ -75,7 +75,7 @@
return rc;
 }

-int card_uart_tx(struct card_uart *cuart, const uint8_t *data, size_t len, 
bool rx_after_complete)
+int card_uart_tx(struct card_uart *cuart, const uint8_t *data, size_t len)
 {
OSMO_ASSERT(cuart);
OSMO_ASSERT(cuart->driver);
@@ -87,7 +87,7 @@
/* disable receiver to avoid receiving what we transmit */
card_uart_ctrl(cuart, CUART_CTL_RX, false);

-   return cuart->driver->ops->async_tx(cuart, data, len, 
rx_after_complete);
+   return cuart->driver->ops->async_tx(cuart, data, len);
 }

 int card_uart_rx(struct card_uart *cuart, uint8_t *data, size_t len)
diff --git a/ccid/cuart.h b/ccid/cuart.h
index c28209f..790c277 100644
--- a/ccid/cuart.h
+++ b/ccid/cuart.h
@@ -30,7 +30,7 @@
 struct card_uart_ops {
int (*open)(struct card_uart *cuart, const char *device_name);
int (*close)(struct card_uart *cuart);
-   int (*async_tx)(struct card_uart *cuart, const uint8_t *data, size_t 
len, bool rx_after_complete);
+   int (*async_tx)(struct card_uart *cuart, const uint8_t *data, size_t 
len);
int (*async_rx)(struct card_uart *cuart, uint8_t *data, size_t len);

int (*ctrl)(struct card_uart *cuart, enum card_uart_ctl ctl, bool 
enable);
@@ -93,7 +93,7 @@
 int card_uart_close(struct card_uart *cuart);

 /*! Schedule (asynchronous) transmit data via UART; optionally enable Rx after 
completion */
-int card_uart_tx(struct card_uart *cuart, const uint8_t *data, size_t len, 
bool rx_after_complete);
+int card_uart_tx(struct card_uart *cuart, const uint8_t *data, size_t len);

 /*! Schedule (asynchronous) receive data via UART (after CUART_E_RX_COMPLETE) 
*/
 int card_uart_rx(struct card_uart *cuart, uint8_t *data, size_t len);
diff --git a/ccid/cuart_driver_tty.c b/ccid/cuart_driver_tty.c
index 7fc8d3a..3695b58 100644
--- a/ccid/cuart_driver_tty.c
+++ b/ccid/cuart_driver_tty.c
@@ -220,7 +220,7 @@
return 0;
 }

-static int tty_uart_async_tx(struct card_uart *cuart, const uint8_t *data, 
size_t len, bool rx_after)
+static int tty_uart_async_tx(struct card_uart *cuart, const uint8_t *data, 
size_t len)
 {
OSMO_ASSERT(cuart->driver == _uart_driver);

diff --git a/ccid/cuart_test.c b/ccid/cuart_test.c
index 0ed6614..d4d8faf 100644
--- a/ccid/cuart_test.c
+++ b/ccid/cuart_test.c
@@ -44,7 +44,7 @@
 static void test_apdu(void)
 {
const uint8_t select_mf[] = "\xa0\xa4\x04\x00\x02\x3f\x00";
-   card_uart_tx(_cuart, select_mf, 5, true);
+   card_uart_tx(_cuart, select_mf, 5);

osmo_select_main(true);
sleep(1);
diff --git a/ccid/iso7816_fsm.c b/ccid/iso7816_fsm.c
index f8fe14a..f20cbcd 100644
--- a/ccid/iso7816_fsm.c
+++ b/ccid/iso7816_fsm.c
@@ -809,7 +809,7 @@
LOGPFSML(fi, LOGL_DEBUG, "Transmitting TPDU header %s via 
UART\n",
 osmo_hexdump_nospc((uint8_t *) tpduh, sizeof(*tpduh)));
osmo_fsm_inst_state_chg(fi, TPDU_S_TX_HDR, 0, 0);
-   card_uart_tx(ip->uart, (uint8_t *) tpduh, sizeof(*tpduh), true);
+   card_uart_tx(ip->uart, (uint8_t *) tpduh, sizeof(*tpduh));
break;
default:
OSMO_ASSERT(0);
@@ -855,7 +855,7 @@
} else if (byte == tpduh->ins) {
if (msgb_l2len(tfp->tpdu)) {
/* transmit all remaining bytes */
-   card_uart_tx(ip->uart, msgb_l2(tfp->tpdu), 
msgb_l2len(tfp->tpdu), true);
+   card_uart_tx(ip->uart, msgb_l2(tfp->tpdu), 
msgb_l2len(tfp->tpdu));
osmo_fsm_inst_state_chg(fi, 
TPDU_S_TX_REMAINING, 0, 0);
} else {
card_uart_set_rx_threshold(ip->uart, tpduh->p3);

--
To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/15696
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-Change-Id: I8f82e9108d0eae86bbe4535403ccc680b7379a0e
Gerrit-Change-Number: 15696
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-MessageType: newchange


Change in ...osmo-bts[master]: remove dummy UL measurement results for lost sacch frames

2019-10-07 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/14762 )

Change subject: remove dummy UL measurement results for lost sacch frames
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/14762
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Idfa123f8d02a9d8be1f6de6923fc2a8628020145
Gerrit-Change-Number: 14762
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 20:38:04 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...pysim[master]: python3 conversion: Use python 2 and 3 compatible exceptions

2019-10-07 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/pysim/+/15503 )

Change subject: python3 conversion: Use python 2 and 3 compatible exceptions
..

python3 conversion: Use python 2 and 3 compatible exceptions

Without that we have:
  $ python3 pySim-read.py
  Using serial reader (port=/dev/ttyUSB0, baudrate=9600) interface
  Traceback (most recent call last):
File "pySim-read.py", line 91, in 
  from pySim.transport.serial import SerialSimLink
File "/home/gnutoo/work/projects/osmocom/pysim/pySim/transport/serial.py", 
line 29, in 
  from pySim.exceptions import NoCardError, ProtocolError
File "/home/gnutoo/work/projects/osmocom/pysim/pySim/exceptions.py", line 
26, in 
  import exceptions
  ModuleNotFoundError: No module named 'exceptions'

Signed-off-by: Denis 'GNUtoo' Carikli 
Change-Id: Ie45dc7ccd72fe077ba3b424f221ff4ed02db436c
---
M pySim/exceptions.py
1 file changed, 9 insertions(+), 6 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/pySim/exceptions.py b/pySim/exceptions.py
index 831b1c9..68303e1 100644
--- a/pySim/exceptions.py
+++ b/pySim/exceptions.py
@@ -23,14 +23,17 @@

 from __future__ import absolute_import

-import exceptions
-
-
-class NoCardError(exceptions.Exception):
+try:
+   # This is for compatibility with python 2 and 3
+   from exceptions import Exception
+except:
pass

-class ProtocolError(exceptions.Exception):
+class NoCardError(Exception):
pass

-class ReaderError(exceptions.Exception):
+class ProtocolError(Exception):
+   pass
+
+class ReaderError(Exception):
pass

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ie45dc7ccd72fe077ba3b424f221ff4ed02db436c
Gerrit-Change-Number: 15503
Gerrit-PatchSet: 5
Gerrit-Owner: gnutoo 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-CC: neels 
Gerrit-MessageType: merged


Change in ...libosmo-netif[master]: tests: osmux_test: Provide More accurate logging expectancies

2019-10-07 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/15670 )

Change subject: tests: osmux_test: Provide More accurate logging expectancies
..


Patch Set 4: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/15670
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I85722ebcb5486426dfe76cdca1b8a0692bb5b111
Gerrit-Change-Number: 15670
Gerrit-PatchSet: 4
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Mon, 07 Oct 2019 20:02:51 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: MGCP_Test: Relax expected number of packets in TC_one_crcx_receive_on...

2019-10-07 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15640 )

Change subject: MGCP_Test: Relax expected number of packets in 
TC_one_crcx_receive_only_rtp
..

MGCP_Test: Relax expected number of packets in TC_one_crcx_receive_only_rtp

The testcase TC_one_crcx_receive_only_rtp performs a short RTP
transmission that lasts about 1 second. Then it conuts out the number of
packets that are transmitted and checks against a fixed value. The
compare values are determined using experimentation and reflect the
number of bytes/packets that one could expect under normal conditions on
an average machine.

However, there may be load sitations on the test host that may cause that
a too little number of packets is transmitted and the test will fail. Lets
reduce the number a bit as the only thing we want to make sure with this
is that there are at least some (more than one or two) packets transmitted

Change-Id: Ie63445d61268d178940ce8d9cfa984519c42041a
---
M mgw/MGCP_Test.ttcn
1 file changed, 9 insertions(+), 2 deletions(-)

Approvals:
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index 41def03..1a45015 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -1601,10 +1601,17 @@

stats := f_rtpem_stats_get(RTPEM[0]);

-   if (stats.num_pkts_tx < 40) {
+   /* Make sure that at least some amount of RTP packets/bytes
+* have has been transmitted. The compare values for
+* stats.num_pkts_tx and stats.bytes_payload_tx are determined
+* using a testrun and the results were devided by 2, so even
+* in load situations we should reach the minimum amount of
+* required packets/bytes */
+
+   if (stats.num_pkts_tx < 24) {
setverdict(fail);
}
-   if (stats.bytes_payload_tx < 190) {
+   if (stats.bytes_payload_tx < 96) {
setverdict(fail);
}


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15640
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ie63445d61268d178940ce8d9cfa984519c42041a
Gerrit-Change-Number: 15640
Gerrit-PatchSet: 5
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in ...osmo-ttcn3-hacks[master]: MGCP_Test: test rtp directions separately in TC_ts101318_rfc5993_rtp_...

2019-10-07 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15641 )

Change subject: MGCP_Test: test rtp directions separately in 
TC_ts101318_rfc5993_rtp_conversion
..

MGCP_Test: test rtp directions separately in TC_ts101318_rfc5993_rtp_conversion

The testcase TC_ts101318_rfc5993_rtp_conversion tests the RTP packet
format conversion of ts101318 to rfc5993 and vice versa. At the moment
the testcase sends RTP packets in both directions at the same time. In
order to simplify the test and to make race conditions less likely, lets
test both directions separately and add some guard time.

Change-Id: Id9b69587f7fb5f6b0da072ac5f4863fd4111e597
---
M mgw/MGCP_Test.ttcn
1 file changed, 20 insertions(+), 6 deletions(-)

Approvals:
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index 1a45015..b46b178 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -1968,7 +1968,7 @@
f_vty_transceive(MGWVTY, "mgcp");
f_vty_transceive(MGWVTY, "rtp-patch rfc5993hr");

-   /* from us to MGW */
+   /* Connection #0 (Bidirectional) */
flow[0] := valueof(t_RtpFlow(mp_local_ip, mp_remote_ip, 111, 
"GSM-HR-08/8000"));
/* bind local RTP emulation sockets */
flow[0].em.portnr := 1;
@@ -1978,7 +1978,7 @@
flow[0].rtp_cfg.tx_fixed_payload := 
'0b11b3eede60be4e3ec68838c7b5'O;
f_flow_create(RTPEM[0], ep, call_id, "sendrecv", flow[0]);

-   /* from MGW back to us */
+   /* Connection #1 (Bidirectional) */
flow[1] := valueof(t_RtpFlow(mp_local_ip, mp_remote_ip, 111, 
"GSM-HR-08/8000"));
flow[1].em.portnr := 2;
flow[1].rtp_cfg := c_RtpemDefaultCfg;
@@ -1987,17 +1987,31 @@
flow[1].rtp_cfg.tx_fixed_payload := 
'000b11b3eede60be4e3ec68838c7b5'O;
f_flow_create(RTPEM[1], ep, call_id, "sendrecv", flow[1]);

-   f_rtpem_mode(RTPEM[1], RTPEM_MODE_BIDIR);
-   f_rtpem_mode(RTPEM[0], RTPEM_MODE_BIDIR);
-
+   /* Send RTP packets to connection #0, receive on connection #1 
*/
+   f_rtpem_mode(RTPEM[1], RTPEM_MODE_RXONLY);
+   f_sleep(0.5);
+   f_rtpem_mode(RTPEM[0], RTPEM_MODE_TXONLY);
f_sleep(1.0);
+   f_rtpem_mode(RTPEM[0], RTPEM_MODE_NONE);
+   f_sleep(0.5);
+   f_rtpem_mode(RTPEM[1], RTPEM_MODE_NONE);

+   /* Send RTP packets to connection #1, receive on connection #0 
*/
+   f_rtpem_mode(RTPEM[0], RTPEM_MODE_RXONLY);
+   f_sleep(0.5);
+   f_rtpem_mode(RTPEM[1], RTPEM_MODE_TXONLY);
+   f_sleep(1.0);
+   f_rtpem_mode(RTPEM[1], RTPEM_MODE_NONE);
+   f_sleep(0.5);
+   f_rtpem_mode(RTPEM[0], RTPEM_MODE_NONE);
+
+   /* Remove RTP flows and check statistics */
f_flow_delete(RTPEM[0]);
f_flow_delete(RTPEM[1], ep, call_id);

+   /* Check for errors */
stats[0] := f_rtpem_stats_get(RTPEM[0]);
stats[1] := f_rtpem_stats_get(RTPEM[1]);
-
f_rtpem_stats_err_check(stats[0]);
f_rtpem_stats_err_check(stats[1]);


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15641
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Id9b69587f7fb5f6b0da072ac5f4863fd4111e597
Gerrit-Change-Number: 15641
Gerrit-PatchSet: 5
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in ...osmo-ttcn3-hacks[master]: MGCP_Test: Make RTP bwe/oa format conversation tests more robust

2019-10-07 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15639 )

Change subject: MGCP_Test: Make RTP bwe/oa format conversation tests more robust
..

MGCP_Test: Make RTP bwe/oa format conversation tests more robust

The following testcases are carried out using two bidirectional
connections on one MGW endpoint.

MGCP_Test.TC_amr_oa_bwe_rtp_conversion
MGCP_Test.TC_amr_oa_oa_rtp_conversion
MGCP_Test.TC_amr_bwe_bwe_rtp_conversion

The test is programmed in a way that the TTCN3 side of the RTP emulation
also works in bidirectional mode. This is prone to run into a race
condition when the RX side is activated but the TX side is already
transmitting.

However, in order to test if the RTP format conversion works we do not
need to test both directions at the same time. Its perfectly fine to do
the one direction first and then do the other afterwards. Lets also add
some guard time while switching the RTP flows.

Change-Id: Idf257cfc1ab45a7f0fb6e1a2f6426f1b3145879b
---
M mgw/MGCP_Test.ttcn
1 file changed, 20 insertions(+), 6 deletions(-)

Approvals:
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index 7ddb6ea..41def03 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -2012,7 +2012,7 @@
 
f_init(ep);

-   /* from us to MGW */
+   /* Connection #0 (Bidirectional) */
flow[0] := valueof(t_RtpFlow(mp_local_ip, mp_remote_ip, 112, 
"AMR/8000"));
/* bind local RTP emulation sockets */
flow[0].em.portnr := 1;
@@ -2023,7 +2023,7 @@
flow[0].fmtp := fmtp0;
f_flow_create(RTPEM[0], ep, call_id, "sendrecv", flow[0]);

-   /* from MGW back to us */
+   /* Connection #1 (Bidirectional) */
flow[1] := valueof(t_RtpFlow(mp_local_ip, mp_remote_ip, 112, 
"AMR/8000"));
flow[1].em.portnr := 2;
flow[1].rtp_cfg := c_RtpemDefaultCfg;
@@ -2033,17 +2033,31 @@
flow[1].fmtp := fmtp1;
f_flow_create(RTPEM[1], ep, call_id, "sendrecv", flow[1]);

-   f_rtpem_mode(RTPEM[1], RTPEM_MODE_BIDIR);
-   f_rtpem_mode(RTPEM[0], RTPEM_MODE_BIDIR);
-
+   /* Send RTP packets to connection #0, receive on connection #1 
*/
+   f_rtpem_mode(RTPEM[1], RTPEM_MODE_RXONLY);
+   f_sleep(0.5);
+   f_rtpem_mode(RTPEM[0], RTPEM_MODE_TXONLY);
f_sleep(1.0);
+   f_rtpem_mode(RTPEM[0], RTPEM_MODE_NONE);
+   f_sleep(0.5);
+   f_rtpem_mode(RTPEM[1], RTPEM_MODE_NONE);

+   /* Send RTP packets to connection #1, receive on connection #0 
*/
+   f_rtpem_mode(RTPEM[0], RTPEM_MODE_RXONLY);
+   f_sleep(0.5);
+   f_rtpem_mode(RTPEM[1], RTPEM_MODE_TXONLY);
+   f_sleep(1.0);
+   f_rtpem_mode(RTPEM[1], RTPEM_MODE_NONE);
+   f_sleep(0.5);
+   f_rtpem_mode(RTPEM[0], RTPEM_MODE_NONE);
+
+   /* Remove RTP flows and check statistics */
f_flow_delete(RTPEM[0]);
f_flow_delete(RTPEM[1], ep, call_id);

+   /* Check for errors */
stats[0] := f_rtpem_stats_get(RTPEM[0]);
stats[1] := f_rtpem_stats_get(RTPEM[1]);
-
f_rtpem_stats_err_check(stats[0]);
f_rtpem_stats_err_check(stats[1]);


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15639
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Idf257cfc1ab45a7f0fb6e1a2f6426f1b3145879b
Gerrit-Change-Number: 15639
Gerrit-PatchSet: 4
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in ...libosmocore[master]: vty: Optionally Set/replace cfg file during cmd 'write file'

2019-10-07 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/15609 )

Change subject: vty: Optionally Set/replace cfg file during cmd 'write file'
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I38edcf902a08b6bd0ebb9aa6fc1a7041421af525
Gerrit-Change-Number: 15609
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 20:01:44 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...libosmocore[master]: vty: Optionally Set/replace cfg file during cmd 'write file'

2019-10-07 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/libosmocore/+/15609 )

Change subject: vty: Optionally Set/replace cfg file during cmd 'write file'
..

vty: Optionally Set/replace cfg file during cmd 'write file'

This way if the process is started with no file associated (eg. no -c
param and default cfg path doesn't exist), config can be later saved
into a file by passing the parameter. Otherwise, until now this message
was displayed:
Can't save to configuration file, using vtysh.

Related: OS#4024
Change-Id: I38edcf902a08b6bd0ebb9aa6fc1a7041421af525
---
M src/vty/command.c
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/vty/command.c b/src/vty/command.c
index 35169eb..0d24b66 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -2927,9 +2927,10 @@
 /* Write current configuration into file. */
 DEFUN(config_write_file,
   config_write_file_cmd,
-  "write file",
+  "write file [PATH]",
   "Write running configuration to memory, network, or terminal\n"
-  "Write to configuration file\n")
+  "Write to configuration file\n"
+  "Set file path to store the config, or replace if already exists\n")
 {
char *failed_file;
int rc;
@@ -2943,6 +2944,9 @@
}
}

+   if (argc == 1)
+   host_config_set(argv[0]);
+
if (host.config == NULL) {
vty_out(vty, "Can't save to configuration file, using vtysh.%s",
VTY_NEWLINE);

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I38edcf902a08b6bd0ebb9aa6fc1a7041421af525
Gerrit-Change-Number: 15609
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in ...osmo-pcu[master]: pcu_l1_if.cpp: Replace value 23 with libosmocore's GSM_MACBLOCK_LEN

2019-10-07 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15686 )

Change subject: pcu_l1_if.cpp: Replace value 23 with libosmocore's 
GSM_MACBLOCK_LEN
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15686
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ieec3dd028fffa1a735afaaf3f93da0a1202d122a
Gerrit-Change-Number: 15686
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Mon, 07 Oct 2019 19:57:45 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-pcu[master]: pcu_l1_if.cpp: Drop unneeded byte in Imm Ass PCH buffer

2019-10-07 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15687 )

Change subject: pcu_l1_if.cpp: Drop unneeded byte in Imm Ass PCH buffer
..

pcu_l1_if.cpp: Drop unneeded byte in Imm Ass PCH buffer

paging group is 3 bytes and imm assign with plen prepended is 23 bytes,
so there's 1 extra byte not needed and makes code confusing.

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

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 6a0d58e..b0dfcc5 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -223,7 +223,7 @@
 void pcu_l1if_tx_pch(bitvec * block, int plen, const char *imsi)
 {
struct gprs_rlcmac_bts *bts = bts_main_data();
-   uint8_t data[3+1+23]; /* prefix PLEN */
+   uint8_t data[3+23]; /* paging group, prefix PLEN */

/* paging group */
if (!imsi || strlen(imsi) < 3)

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15687
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Id7835e5aa1506505ff54e019b38f30111f79b5dc
Gerrit-Change-Number: 15687
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in ...osmo-pcu[master]: pcu_l1_if.cpp: Replace value 23 with libosmocore's GSM_MACBLOCK_LEN

2019-10-07 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15686 )

Change subject: pcu_l1_if.cpp: Replace value 23 with libosmocore's 
GSM_MACBLOCK_LEN
..

pcu_l1_if.cpp: Replace value 23 with libosmocore's GSM_MACBLOCK_LEN

Change-Id: Ieec3dd028fffa1a735afaaf3f93da0a1202d122a
---
M src/pcu_l1_if.cpp
1 file changed, 6 insertions(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 4ed512a..883cb22 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -208,16 +208,16 @@
 void pcu_l1if_tx_agch(bitvec * block, int plen)
 {
struct gprs_rlcmac_bts *bts = bts_main_data();
-   uint8_t data[23]; /* prefix PLEN */
-
+   uint8_t data[GSM_MACBLOCK_LEN]; /* prefix PLEN */
+
/* FIXME: why does OpenBTS has no PLEN and no fill in message? */
bitvec_pack(block, data + 1);
data[0] = (plen << 2) | 0x01;

if (bts->gsmtap_categ_mask & (1 << PCU_GSMTAP_C_DL_AGCH))
-   gsmtap_send(bts->gsmtap, 0, 0, GSMTAP_CHANNEL_AGCH, 0, 0, 0, 0, 
data, 23);
+   gsmtap_send(bts->gsmtap, 0, 0, GSMTAP_CHANNEL_AGCH, 0, 0, 0, 0, 
data, GSM_MACBLOCK_LEN);

-   pcu_tx_data_req(0, 0, PCU_IF_SAPI_AGCH, 0, 0, 0, data, 23);
+   pcu_tx_data_req(0, 0, PCU_IF_SAPI_AGCH, 0, 0, 0, data, 
GSM_MACBLOCK_LEN);
 }

 #define PAGING_GROUP_LEN 3
@@ -379,8 +379,8 @@
case PCU_IF_SAPI_PTCCH:
/* FIXME */
{
-   struct msgb *msg = msgb_alloc(23, "l1_prim");
-   memset(msgb_put(msg, 23), 0x2b, 23);
+   struct msgb *msg = msgb_alloc(GSM_MACBLOCK_LEN, 
"l1_prim");
+   memset(msgb_put(msg, GSM_MACBLOCK_LEN), 0x2b, 
GSM_MACBLOCK_LEN);
pcu_l1if_tx_ptcch(msg, rts_req->trx_nr, rts_req->ts_nr,
rts_req->arfcn, rts_req->fn, rts_req->block_nr);
}

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15686
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ieec3dd028fffa1a735afaaf3f93da0a1202d122a
Gerrit-Change-Number: 15686
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in ...osmo-pcu[master]: pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items

2019-10-07 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15683 )

Change subject: pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items
..

pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items

Change-Id: I32876858e3e93951e965b0fc7875c95c1f36f3ac
---
M src/pcu_l1_if.cpp
1 file changed, 12 insertions(+), 8 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index b0dfcc5..4ed512a 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -220,27 +220,31 @@
pcu_tx_data_req(0, 0, PCU_IF_SAPI_AGCH, 0, 0, 0, data, 23);
 }

+#define PAGING_GROUP_LEN 3
 void pcu_l1if_tx_pch(bitvec * block, int plen, const char *imsi)
 {
struct gprs_rlcmac_bts *bts = bts_main_data();
-   uint8_t data[3+23]; /* paging group, prefix PLEN */
+   uint8_t data[PAGING_GROUP_LEN + GSM_MACBLOCK_LEN];

-   /* paging group */
-   if (!imsi || strlen(imsi) < 3)
+   /* prepend paging group */
+   if (!imsi || strlen(imsi) < PAGING_GROUP_LEN)
return;
-   imsi += strlen(imsi) - 3;
+   imsi += strlen(imsi) - PAGING_GROUP_LEN;
data[0] = imsi[0];
data[1] = imsi[1];
data[2] = imsi[2];

-   OSMO_ASSERT(block->data_len <= sizeof(data) - (3+1));
-   bitvec_pack(block, data + 3+1);
+   /* block provided by upper layer comes without first byte (plen),
+* prepend it manually:
+*/
+   OSMO_ASSERT(sizeof(data) >= PAGING_GROUP_LEN + 1 + block->data_len);
data[3] = (plen << 2) | 0x01;
+   bitvec_pack(block, data + PAGING_GROUP_LEN + 1);

if (bts->gsmtap_categ_mask & (1 << PCU_GSMTAP_C_DL_PCH))
-   gsmtap_send(bts->gsmtap, 0, 0, GSMTAP_CHANNEL_PCH, 0, 0, 0, 0, 
data + 3, 23);
+   gsmtap_send(bts->gsmtap, 0, 0, GSMTAP_CHANNEL_PCH, 0, 0, 0, 0, 
data + 3, GSM_MACBLOCK_LEN);

-   pcu_tx_data_req(0, 0, PCU_IF_SAPI_PCH, 0, 0, 0, data, 23+3);
+   pcu_tx_data_req(0, 0, PCU_IF_SAPI_PCH, 0, 0, 0, data, PAGING_GROUP_LEN 
+ GSM_MACBLOCK_LEN);
 }

 extern "C" void pcu_rx_block_time(uint16_t arfcn, uint32_t fn, uint8_t ts_no)

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15683
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I32876858e3e93951e965b0fc7875c95c1f36f3ac
Gerrit-Change-Number: 15683
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-CC: fixeria 
Gerrit-MessageType: merged


Change in ...osmo-pcu[master]: pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items

2019-10-07 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15683 )

Change subject: pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15683
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I32876858e3e93951e965b0fc7875c95c1f36f3ac
Gerrit-Change-Number: 15683
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-CC: fixeria 
Gerrit-Comment-Date: Mon, 07 Oct 2019 19:57:22 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: pcu: Allow tests to overwrite pcuif INFO_IND params

2019-10-07 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15674 )

Change subject: pcu: Allow tests to overwrite pcuif INFO_IND params
..

pcu: Allow tests to overwrite pcuif INFO_IND params

Change-Id: I75c746b822184fdcc966d77a7c6a0a6918c236e6
---
M library/PCUIF_Types.ttcn
M pcu/PCU_Tests_RAW.ttcn
2 files changed, 47 insertions(+), 99 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/library/PCUIF_Types.ttcn b/library/PCUIF_Types.ttcn
index a36e261..ae0762a 100644
--- a/library/PCUIF_Types.ttcn
+++ b/library/PCUIF_Types.ttcn
@@ -677,62 +677,13 @@
ts_PCUIF_InfoTrx, ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL, 
ts_PCUIF_InfoTrxNULL,
ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL, 
ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL };

-
 template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t 
bts_nr,
-template (value) uint16_t nsei,
-template (value) uint16_t 
nsvci,
-template (value) uint16_t bvci,
-template (value) uint16_t 
local_port,
-template (value) uint16_t 
remote_port,
-template (value) OCT4 
remote_ip,
-template (value) PCUIF_Flags 
flags := c_PCUIF_Flags_default,
-template (value) uint16_t mcc 
:= 262,
-template (value) uint16_t mnc 
:= 42,
-template (value) uint16_t lac 
:= 13135,
-template (value) uint8_t rac 
:= 0,
-template (value) uint16_t 
cell_id := 20960,
-template (value) uint8_t bsic 
:= 7,
-template (value) 
PCUIF_InfoTrxs trx := ts_PCUIF_InfoTrxs_def,
-template (value) uint32_t 
version := PCU_IF_VERSION) := {
+template (value) 
PCUIF_info_ind info_ind) := {
msg_type := PCU_IF_MSG_INFO_IND,
bts_nr := bts_nr,
spare := ''O,
u := {
-   info_ind := {
-   version := version,
-   flags := flags,
-   trx := trx,
-   bsic := bsic,
-   mcc := mcc,
-   mnc := mnc,
-   mnc_3_digits := 0,
-   lac := lac,
-   rac := rac,
-   nsei := nsei,
-   nse_timer := { 3, 3, 3, 3, 30, 3, 10 },
-   cell_timer := { 3, 3, 3, 3, 3, 10, 3, 10, 3, 10, 3 },
-   cell_id := cell_id,
-   repeat_time := 5 * 50,
-   repeat_count := 3,
-   bvci := bvci,
-   t3142 := 20,
-   t3169 := 5,
-   t3191 := 5,
-   t3193_10ms := 160,
-   t3195 := 5,
-   t3101 := 10,
-   t3103 := 4,
-   t3105 := 8,
-   cv_countdown := 15,
-   dl_tbf_ext := 250 * 10, /* ms */
-   ul_tbf_ext := 250 * 10, /* ms */
-   initial_cs := 2,
-   initial_mcs := 6,
-   nsvci := { nsvci, 0 },
-   local_pprt := { local_port, 0 },
-   remote_port := { remote_port, 0 },
-   remote_ip := { remote_ip , ''O }
-   }
+   info_ind := info_ind
}
 }
 template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?,
diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn
index 4d20027..d5e53e2 100644
--- a/pcu/PCU_Tests_RAW.ttcn
+++ b/pcu/PCU_Tests_RAW.ttcn
@@ -69,9 +69,50 @@
}
 }

+/* FIXME: make sure to use parameters from mp_gb_cfg.cell_id in the PCU INFO 
IND */
+template (value) PCUIF_info_ind ts_PCUIF_INFO_default := {
+   version := PCU_IF_VERSION,
+   flags := c_PCUIF_Flags_default,
+   trx := valueof(ts_PCUIF_InfoTrxs_def),
+   bsic := 7,
+   mcc := 262,
+   mnc := 42,
+   mnc_3_digits := 0,
+   lac := 13135,
+   rac := 0,
+   nsei := mp_nsconfig.nsei,
+   nse_timer := { 3, 3, 3, 3, 30, 3, 10 },
+   cell_timer := { 3, 3, 3, 3, 3, 10, 3, 10, 

Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce func helper f_imm_ass_verify_ul_tbf_ass()

2019-10-07 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15675 )

Change subject: pcu: Introduce func helper f_imm_ass_verify_ul_tbf_ass()
..

pcu: Introduce func helper f_imm_ass_verify_ul_tbf_ass()

Change-Id: I5b8a7ca5a4d0f905bf68949978811b139568c237
---
M pcu/PCU_Tests_RAW.ttcn
1 file changed, 28 insertions(+), 16 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn
index d5e53e2..344c39f 100644
--- a/pcu/PCU_Tests_RAW.ttcn
+++ b/pcu/PCU_Tests_RAW.ttcn
@@ -549,6 +549,28 @@
return false;
 }

+private function f_imm_ass_verify_ul_tbf_ass(GsmRrMessage rr_imm_ass, out 
PacketUlAssign ul_tbf_ass)
+runs on RAW_PCU_Test_CT return boolean {
+
+   /* Make sure we received an UL TBF Assignment */
+   if (match(rr_imm_ass, tr_IMM_TBF_ASS(dl := false, rest := 
tr_IaRestOctets_ULAss(? {
+   ul_tbf_ass := 
rr_imm_ass.payload.imm_ass.rest_octets.hh.pa.uldl.ass.ul;
+   log("Rx Uplink TBF assignment: ", ul_tbf_ass);
+   setverdict(pass);
+   } else {
+   setverdict(fail, "Failed to match UL TBF Assignment");
+   return false;
+   }
+
+   /* Make sure we have got a TBF with Dynamic Block Allocation */
+   if (ul_tbf_ass.dynamic == omit) {
+   setverdict(fail, "Single Block Allocation is not handled by ", 
testcasename());
+   return false;
+   }
+
+   return true;
+}
+
 /* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */
 private function f_pcuif_tx_data_ind(octetstring data, int16_t lqual_cb := 0)
 runs on RAW_PCU_Test_CT {
@@ -847,10 +869,10 @@
 private template integer CS4_lqual_dB_range := (12 .. infinity);

 testcase TC_cs_lqual_ul_tbf() runs on RAW_PCU_Test_CT {
+   var GsmRrMessage rr_imm_ass;
var PacketUlAssign ul_tbf_ass;
var RlcmacDlBlock dl_block;
var PCUIF_Message pcu_msg;
-   var GsmRrMessage rr_msg;
var octetstring data;
var boolean ok;
 
@@ -858,25 +880,15 @@
f_init_raw(testcasename());

/* Establish an Uplink TBF */
-   ok := f_establish_tbf(rr_msg);
+   ok := f_establish_tbf(rr_imm_ass);
if (not ok) {
-   setverdict(fail, "Failed to establish an Uplink TBF");
+   setverdict(fail, "Failed to establish TBF");
mtc.stop;
}

-   /* Make sure we received an UL TBF Assignment */
-   if (match(rr_msg, tr_IMM_TBF_ASS(dl := false, rest := 
tr_IaRestOctets_ULAss(? {
-   ul_tbf_ass := 
rr_msg.payload.imm_ass.rest_octets.hh.pa.uldl.ass.ul;
-   log("Rx Uplink TBF assignment: ", ul_tbf_ass);
-   setverdict(pass);
-   } else {
-   setverdict(fail, "Failed to match UL TBF Assignment");
-   mtc.stop;
-   }
-
-   /* Make sure we have got a TBF with Dynamic Block Allocation */
-   if (ul_tbf_ass.dynamic == omit) {
-   setverdict(fail, "Single Block Allocation is not handled by ", 
testcasename());
+   ok := f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
+   if (not ok) {
+   setverdict(fail, "Immediate Assignment not an Uplink TBF");
mtc.stop;
}


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15675
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5b8a7ca5a4d0f905bf68949978811b139568c237
Gerrit-Change-Number: 15675
Gerrit-PatchSet: 4
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in ...osmo-ttcn3-hacks[master]: pcu: TC_t3169: Check ul block reaches SGSN before timer expiration

2019-10-07 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15680 )

Change subject: pcu: TC_t3169: Check ul block reaches SGSN before timer 
expiration
..

pcu: TC_t3169: Check ul block reaches SGSN before timer expiration

Change-Id: Ic6fd82dc5037d08278d36aed9b6e72e80da5c42f
---
M pcu/PCU_Tests_RAW.ttcn
1 file changed, 10 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn
index f0c8b1d..0771cf9 100644
--- a/pcu/PCU_Tests_RAW.ttcn
+++ b/pcu/PCU_Tests_RAW.ttcn
@@ -974,6 +974,10 @@
var PCUIF_Message pcu_msg;
var octetstring data;
var boolean ok;
+   var OCT4 tlli := '0001'O;
+
+   /* Initialize NS/BSSGP side */
+   f_init_bssgp();

info_ind := valueof(ts_PCUIF_INFO_default);
/* Set timer to 1 sec (default 5) to speedup test: */
@@ -982,6 +986,10 @@
/* Initialize the PCU interface abstraction */
f_init_raw(testcasename(), info_ind);

+   /* Establish BSSGP connection to the PCU */
+   f_bssgp_establish();
+   f_bssgp_client_llgmm_assign(''O, tlli);
+
/* Establish an Uplink TBF */
ok := f_establish_tbf(rr_imm_ass);
if (not ok) {
@@ -998,6 +1006,8 @@
/* Send one UL block and make sure it is ACKED fine */
f_tx_rlcmac_ul_n_blocks(ul_tbf_ass, 1);
f_rx_rlcmac_dl_block_exp_ack_nack(dl_block);
+   /* UL block should be received in SGSN */
+   BSSGP[0].receive(tr_BSSGP_UL_UD(tlli, mp_gb_cfg.cell_id));

/* Wait until T3169 fires (plus 1 extra sec to make sure) */
f_sleep(int2float(info_ind.t3169) + 1.0);

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15680
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ic6fd82dc5037d08278d36aed9b6e72e80da5c42f
Gerrit-Change-Number: 15680
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in ...osmo-pcu[master]: pcu_l1_if.cpp: Drop unneeded byte in Imm Ass PCH buffer

2019-10-07 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15687 )

Change subject: pcu_l1_if.cpp: Drop unneeded byte in Imm Ass PCH buffer
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15687
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Id7835e5aa1506505ff54e019b38f30111f79b5dc
Gerrit-Change-Number: 15687
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Mon, 07 Oct 2019 19:57:02 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: pcu: TC_t3169: Check ul block reaches SGSN before timer expiration

2019-10-07 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15680 )

Change subject: pcu: TC_t3169: Check ul block reaches SGSN before timer 
expiration
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15680
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ic6fd82dc5037d08278d36aed9b6e72e80da5c42f
Gerrit-Change-Number: 15680
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Mon, 07 Oct 2019 19:56:34 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce test TC_t3169

2019-10-07 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15676 )

Change subject: pcu: Introduce test TC_t3169
..

pcu: Introduce test TC_t3169

Related: OS#3928
Change-Id: I587413a7de7956daee3423057530e4052a55ba88
---
M library/RLCMAC_Types.ttcn
M pcu/PCU_Tests_RAW.ttcn
2 files changed, 93 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved



diff --git a/library/RLCMAC_Types.ttcn b/library/RLCMAC_Types.ttcn
index ad9d8f4..359cb74 100644
--- a/library/RLCMAC_Types.ttcn
+++ b/library/RLCMAC_Types.ttcn
@@ -306,6 +306,28 @@
usf := usf
}

+   template RlcmacDlBlock tr_RLCMAC_DUMMY_CTRL(template uint3_t usf := ?) 
:= {
+   ctrl := {
+   mac_hdr := {
+   payload_type := (MAC_PT_RLCMAC_NO_OPT, 
MAC_PT_RLCMAC_OPT),
+   rrbp:= ?,
+   rrbp_valid := ?,
+   usf := usf
+   },
+   opt := *,
+   payload := {
+   msg_type := PACKET_DL_DUMMY_CTRL,
+   u := {
+   dl_dummy := {
+   page_mode := ?,
+   persistence_levels_present := ?,
+   persistence_levels := *
+   }
+   }
+   }
+   }
+   }
+
/* Receive Template for Downlink ACK/NACK */
template RlcmacDlBlock tr_RLCMAC_ACK_NACK(template uint5_t ul_tfi, 
template GprsTlli tlli := ?) := {
ctrl := {
diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn
index 344c39f..f0c8b1d 100644
--- a/pcu/PCU_Tests_RAW.ttcn
+++ b/pcu/PCU_Tests_RAW.ttcn
@@ -602,6 +602,25 @@
f_pcuif_tx_data_ind(data, lqual_cb);
 }

+private function f_tx_rlcmac_ul_n_blocks(PacketUlAssign ul_tbf_ass, integer 
num_blocks := 1)
+runs on RAW_PCU_Test_CT {
+   var template (value) RlcmacUlBlock ul_data := t_RLCMAC_UL_DATA(
+   tfi := ul_tbf_ass.dynamic.tfi_assignment,
+   cv := num_blocks - 1, /* num UL blocks to be sent (to be 
overridden in loop) */
+   bsn := 0, /* TODO: what should be here? */
+   blocks := { /* To be generated in loop */ });
+
+   /* HACK: patch missing TLLI; otherwise OsmoPCU rejects DATA.req */
+   ul_data.data.tlli := '0001'O;
+
+   for (var integer i := 0; i < num_blocks; i := i + 1) {
+   /* Prepare a new UL block (CV, random payload) */
+   ul_data.data.mac_hdr.countdown := (num_blocks - i - 1);
+   ul_data.data.blocks := { 
valueof(t_RLCMAC_LLCBLOCK(f_rnd_octstring(10))) };
+   f_tx_rlcmac_ul_block(ul_data);
+   }
+}
+
 private function f_rx_rlcmac_dl_block(out RlcmacDlBlock dl_block)
 runs on RAW_PCU_Test_CT {
var PCUIF_Message pcu_msg;
@@ -618,6 +637,15 @@
}
 }

+private function f_rx_rlcmac_dl_block_exp_dummy(out RlcmacDlBlock dl_block)
+runs on RAW_PCU_Test_CT {
+   f_rx_rlcmac_dl_block(dl_block);
+   if (not match(dl_block, tr_RLCMAC_DUMMY_CTRL())) {
+   setverdict(fail, "Failed to match Packet DUMMY DL");
+   mtc.stop;
+   }
+}
+
 testcase TC_pcuif_suspend() runs on RAW_PCU_Test_CT {
var octetstring ra_id := 
enc_RoutingAreaIdentification(mp_gb_cfg.cell_id.ra_id);
var GprsTlli tlli := ''O;
@@ -937,6 +965,48 @@
}
 }

+/* Verify PCU drops TBF after some time of inactivity. */
+testcase TC_t3169() runs on RAW_PCU_Test_CT {
+   var PCUIF_info_ind info_ind;
+   var GsmRrMessage rr_imm_ass;
+   var PacketUlAssign ul_tbf_ass;
+   var RlcmacDlBlock dl_block;
+   var PCUIF_Message pcu_msg;
+   var octetstring data;
+   var boolean ok;
+
+   info_ind := valueof(ts_PCUIF_INFO_default);
+   /* Set timer to 1 sec (default 5) to speedup test: */
+   info_ind.t3169 := 1;
+
+   /* Initialize the PCU interface abstraction */
+   f_init_raw(testcasename(), info_ind);
+
+   /* Establish an Uplink TBF */
+   ok := f_establish_tbf(rr_imm_ass);
+   if (not ok) {
+   setverdict(fail, "Failed to establish TBF");
+   mtc.stop;
+   }
+
+   ok := f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
+   if (not ok) {
+   setverdict(fail, "Immediate Assignment not an Uplink TBF");
+   mtc.stop;
+   }
+
+   /* Send one UL block and make sure it is ACKED fine */
+   f_tx_rlcmac_ul_n_blocks(ul_tbf_ass, 1);
+   f_rx_rlcmac_dl_block_exp_ack_nack(dl_block);
+
+   /* Wait until T3169 fires (plus 1 extra sec to make 

Change in ...osmo-ttcn3-hacks[master]: pcu: Allow tests to overwrite pcuif INFO_IND params

2019-10-07 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15674 )

Change subject: pcu: Allow tests to overwrite pcuif INFO_IND params
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15674
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I75c746b822184fdcc966d77a7c6a0a6918c236e6
Gerrit-Change-Number: 15674
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 19:56:10 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce func helper f_imm_ass_verify_ul_tbf_ass()

2019-10-07 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15675 )

Change subject: pcu: Introduce func helper f_imm_ass_verify_ul_tbf_ass()
..


Patch Set 4: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15675
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5b8a7ca5a4d0f905bf68949978811b139568c237
Gerrit-Change-Number: 15675
Gerrit-PatchSet: 4
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 19:56:14 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-pcu[master]: pcu_l1_if.cpp: Drop unneeded byte in Imm Ass PCH buffer

2019-10-07 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15687


Change subject: pcu_l1_if.cpp: Drop unneeded byte in Imm Ass PCH buffer
..

pcu_l1_if.cpp: Drop unneeded byte in Imm Ass PCH buffer

paging group is 3 bytes and imm assign with plen prepended is 23 bytes,
so there's 1 extra byte not needed and makes code confusing.

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



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

diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 6a0d58e..b0dfcc5 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -223,7 +223,7 @@
 void pcu_l1if_tx_pch(bitvec * block, int plen, const char *imsi)
 {
struct gprs_rlcmac_bts *bts = bts_main_data();
-   uint8_t data[3+1+23]; /* prefix PLEN */
+   uint8_t data[3+23]; /* paging group, prefix PLEN */

/* paging group */
if (!imsi || strlen(imsi) < 3)

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15687
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Id7835e5aa1506505ff54e019b38f30111f79b5dc
Gerrit-Change-Number: 15687
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-MessageType: newchange


Change in ...osmo-pcu[master]: pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items

2019-10-07 Thread pespin
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-pcu/+/15683

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

Change subject: pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items
..

pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items

Change-Id: I32876858e3e93951e965b0fc7875c95c1f36f3ac
---
M src/pcu_l1_if.cpp
1 file changed, 12 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/83/15683/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15683
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I32876858e3e93951e965b0fc7875c95c1f36f3ac
Gerrit-Change-Number: 15683
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria 
Gerrit-MessageType: newpatchset


Change in ...osmo-pcu[master]: pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items

2019-10-07 Thread pespin
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-pcu/+/15683

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

Change subject: pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items
..

pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items

Change-Id: I32876858e3e93951e965b0fc7875c95c1f36f3ac
---
M src/pcu_l1_if.cpp
1 file changed, 12 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/83/15683/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15683
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I32876858e3e93951e965b0fc7875c95c1f36f3ac
Gerrit-Change-Number: 15683
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria 
Gerrit-MessageType: newpatchset


Change in ...osmo-pcu[master]: pcu_l1_if.cpp: Replace value 23 with libosmocore's GSM_MACBLOCK_LEN

2019-10-07 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15686


Change subject: pcu_l1_if.cpp: Replace value 23 with libosmocore's 
GSM_MACBLOCK_LEN
..

pcu_l1_if.cpp: Replace value 23 with libosmocore's GSM_MACBLOCK_LEN

Change-Id: Ieec3dd028fffa1a735afaaf3f93da0a1202d122a
---
M src/pcu_l1_if.cpp
1 file changed, 6 insertions(+), 6 deletions(-)



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

diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 4d37afa..30e4524 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -208,16 +208,16 @@
 void pcu_l1if_tx_agch(bitvec * block, int plen)
 {
struct gprs_rlcmac_bts *bts = bts_main_data();
-   uint8_t data[23]; /* prefix PLEN */
-
+   uint8_t data[GSM_MACBLOCK_LEN]; /* prefix PLEN */
+
/* FIXME: why does OpenBTS has no PLEN and no fill in message? */
bitvec_pack(block, data + 1);
data[0] = (plen << 2) | 0x01;

if (bts->gsmtap_categ_mask & (1 << PCU_GSMTAP_C_DL_AGCH))
-   gsmtap_send(bts->gsmtap, 0, 0, GSMTAP_CHANNEL_AGCH, 0, 0, 0, 0, 
data, 23);
+   gsmtap_send(bts->gsmtap, 0, 0, GSMTAP_CHANNEL_AGCH, 0, 0, 0, 0, 
data, GSM_MACBLOCK_LEN);

-   pcu_tx_data_req(0, 0, PCU_IF_SAPI_AGCH, 0, 0, 0, data, 23);
+   pcu_tx_data_req(0, 0, PCU_IF_SAPI_AGCH, 0, 0, 0, data, 
GSM_MACBLOCK_LEN);
 }

 #define PAGING_GROUP_LEN 3
@@ -379,8 +379,8 @@
case PCU_IF_SAPI_PTCCH:
/* FIXME */
{
-   struct msgb *msg = msgb_alloc(23, "l1_prim");
-   memset(msgb_put(msg, 23), 0x2b, 23);
+   struct msgb *msg = msgb_alloc(GSM_MACBLOCK_LEN, 
"l1_prim");
+   memset(msgb_put(msg, GSM_MACBLOCK_LEN), 0x2b, 
GSM_MACBLOCK_LEN);
pcu_l1if_tx_ptcch(msg, rts_req->trx_nr, rts_req->ts_nr,
rts_req->arfcn, rts_req->fn, rts_req->block_nr);
}

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15686
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ieec3dd028fffa1a735afaaf3f93da0a1202d122a
Gerrit-Change-Number: 15686
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-MessageType: newchange


Change in ...osmo-trx[master]: add XTRX support

2019-10-07 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/15685 )

Change subject: add XTRX support
..


Patch Set 1: Code-Review-1

(19 comments)

https://gerrit.osmocom.org/#/c/15685/1/Transceiver52M/device/xtrx/XTRXDevice.cpp
File Transceiver52M/device/xtrx/XTRXDevice.cpp:

https://gerrit.osmocom.org/#/c/15685/1/Transceiver52M/device/xtrx/XTRXDevice.cpp@37
PS1, Line 37: static int time_tx_corr = 60; //20+20+20+20+20;
20+20+20+20+20 is not 60 lol


https://gerrit.osmocom.org/#/c/15685/1/Transceiver52M/device/xtrx/XTRXDevice.cpp@49
PS1, Line 49: << " rx_path(0): " << (rx_paths.size() ? 
rx_paths[0] : "<>")
I don't remember now how tx_paths/rx_pathsa re generated, but I bet it's always 
populated to be size() == chans, and I doubt chans can be zero (int that case 
we should exit way before).


https://gerrit.osmocom.org/#/c/15685/1/Transceiver52M/device/xtrx/XTRXDevice.cpp@52
PS1, Line 52:   txsps = tx_sps;
You can probably set those around line 42 out of the body of the function 
(constructor initializers).


https://gerrit.osmocom.org/#/c/15685/1/Transceiver52M/device/xtrx/XTRXDevice.cpp@173
PS1, Line 173: bool XTRXDevice::start()
trailing whitespace


https://gerrit.osmocom.org/#/c/15685/1/Transceiver52M/device/xtrx/XTRXDevice.cpp@177
PS1, Line 177:  return false;
would be great checking other devices to see if we actually return true here.


https://gerrit.osmocom.org/#/c/15685/1/Transceiver52M/device/xtrx/XTRXDevice.cpp@194
PS1, Line 194:  xtrx_set_antenna(device, XTRX_TX_AUTO);
so rx_path/tx_path VTY params are not really used yet?


https://gerrit.osmocom.org/#/c/15685/1/Transceiver52M/device/xtrx/XTRXDevice.cpp@230
PS1, Line 230: bool XTRXDevice::stop()
trailing whitespace


https://gerrit.osmocom.org/#/c/15685/1/Transceiver52M/device/xtrx/XTRXDevice.cpp@265
PS1, Line 265: }
trailing whitespace


https://gerrit.osmocom.org/#/c/15685/1/Transceiver52M/device/xtrx/XTRXDevice.cpp@280
PS1, Line 280:  int res = xtrx_set_gain(device, XTRX_CH_AB, XTRX_TX_PAD_GAIN, 
dB - 30, );
db - 30 ?


https://gerrit.osmocom.org/#/c/15685/1/Transceiver52M/device/xtrx/XTRXDevice.cpp@311
PS1, Line 311:  TIMESTAMP 
timestamp, bool *underrun, unsigned *RSSI)
Please fix indenting for params, they should be under the "(" character. ( in 
all functions!).


https://gerrit.osmocom.org/#/c/15685/1/Transceiver52M/device/xtrx/XTRXDevice.cpp@322
PS1, Line 322:  int res = xtrx_recv_sync_ex(device, );
You probably need to add code to use smpl_buf in here later on, not needed for 
now though.


https://gerrit.osmocom.org/#/c/15685/1/Transceiver52M/device/xtrx/XTRXDevice.cpp@345
PS1, Line 345:  if (!started)
I think this should never happen, because Transceiver stops threads calling 
this function on those conditions.


https://gerrit.osmocom.org/#/c/15685/1/Transceiver52M/device/xtrx/XTRXDevice.cpp@361
PS1, Line 361:  if (*underrun) {
No need for brackets here.


https://gerrit.osmocom.org/#/c/15685/1/Transceiver52M/device/xtrx/XTRXDevice.cpp@370
PS1, Line 370:  LOG(ALERT) << "CH" << chan << ": RX ANTENNA: " << ant.c_str();
probably want to add "(Not implemented)" here.


https://gerrit.osmocom.org/#/c/15685/1/Transceiver52M/device/xtrx/XTRXDevice.cpp@401
PS1, Line 401: bool XTRXDevice::updateAlignment(TIMESTAMP timestamp)
trailing whitespace


https://gerrit.osmocom.org/#/c/15685/1/Transceiver52M/device/xtrx/XTRXDevice.cpp@403
PS1, Line 403:  LOG(ALERT) << "Update Aligment " << timestamp;
Since requiresRadioAlign() returns false, this should never be called, right?


https://gerrit.osmocom.org/#/c/15685/1/Transceiver52M/device/xtrx/XTRXDevice.cpp@419
PS1, Line 419:<< "actual freq: " << actual << 
std::endl;
Fix indent.


https://gerrit.osmocom.org/#/c/15685/1/contrib/systemd/Makefile.am
File contrib/systemd/Makefile.am:

https://gerrit.osmocom.org/#/c/15685/1/contrib/systemd/Makefile.am@25
PS1, Line 25: EXTRA_DIST = $(SYSTEMD_SERVICES)
That's wrong I'd say. You want to keep all files in EXTRA_DIST, because someone 
else may decide to compile with different TRX device support from the archive 
later on, so all of themm need to be available.


https://gerrit.osmocom.org/#/c/15685/1/doc/examples/osmo-trx-xtrx/osmo-trx-xtrx.cfg
File doc/examples/osmo-trx-xtrx/osmo-trx-xtrx.cfg:

https://gerrit.osmocom.org/#/c/15685/1/doc/examples/osmo-trx-xtrx/osmo-trx-xtrx.cfg@21
PS1, Line 21:   tx-path BAND1
Do you use same names for tx/rx paths as LimeSUite? Otherwise this is wrong.



--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/15685
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I1067dfef53aa2669cc7c189cccae10074c674390
Gerrit-Change-Number: 15685
Gerrit-PatchSet: 1
Gerrit-Owner: rauf.gyulal...@fairwaves.co
Gerrit-Reviewer: 

Change in ...osmo-trx[master]: CommonLibs: check HAVE_CONFIG_H before including it

2019-10-07 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/15684 )

Change subject: CommonLibs: check HAVE_CONFIG_H before including it
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/15684/1/CommonLibs/trx_vty.c
File CommonLibs/trx_vty.c:

https://gerrit.osmocom.org/#/c/15684/1/CommonLibs/trx_vty.c@42
PS1, Line 42: #include "config.h"
> You are also changing the path here. […]
Also interesting, how can it happen that you run without having config.h? I'd 
say that's not expected.



--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/15684
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Idb9e938e7794b67b1db23a31e106c8945f79cf24
Gerrit-Change-Number: 15684
Gerrit-PatchSet: 1
Gerrit-Owner: rauf.gyulal...@fairwaves.co
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 18:09:39 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin 
Gerrit-MessageType: comment


Change in ...osmo-trx[master]: CommonLibs: check HAVE_CONFIG_H before including it

2019-10-07 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/15684 )

Change subject: CommonLibs: check HAVE_CONFIG_H before including it
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/15684/1/CommonLibs/trx_vty.c
File CommonLibs/trx_vty.c:

https://gerrit.osmocom.org/#/c/15684/1/CommonLibs/trx_vty.c@42
PS1, Line 42: #include "config.h"
You are also changing the path here. Why?



--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/15684
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Idb9e938e7794b67b1db23a31e106c8945f79cf24
Gerrit-Change-Number: 15684
Gerrit-PatchSet: 1
Gerrit-Owner: rauf.gyulal...@fairwaves.co
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 18:08:47 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...osmo-trx[master]: CommonLibs: check HAVE_CONFIG_H before including it

2019-10-07 Thread Name of user not set
rauf.gyulal...@fairwaves.co has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/15684


Change subject: CommonLibs: check HAVE_CONFIG_H before including it
..

CommonLibs: check HAVE_CONFIG_H before including it

Change-Id: Idb9e938e7794b67b1db23a31e106c8945f79cf24
---
M CommonLibs/trx_vty.c
1 file changed, 4 insertions(+), 1 deletion(-)



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

diff --git a/CommonLibs/trx_vty.c b/CommonLibs/trx_vty.c
index bac9653..9a9e040 100644
--- a/CommonLibs/trx_vty.c
+++ b/CommonLibs/trx_vty.c
@@ -37,7 +37,10 @@

 #include "trx_rate_ctr.h"
 #include "trx_vty.h"
-#include "../config.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif

 static struct trx_ctx* g_trx_ctx;


--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/15684
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Idb9e938e7794b67b1db23a31e106c8945f79cf24
Gerrit-Change-Number: 15684
Gerrit-PatchSet: 1
Gerrit-Owner: rauf.gyulal...@fairwaves.co
Gerrit-MessageType: newchange


Change in ...osmo-trx[master]: add XTRX support

2019-10-07 Thread Name of user not set
rauf.gyulal...@fairwaves.co has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/15685


Change subject: add XTRX support
..

add XTRX support

Change-Id: I1067dfef53aa2669cc7c189cccae10074c674390
---
M Transceiver52M/Makefile.am
M Transceiver52M/device/Makefile.am
A Transceiver52M/device/xtrx/Makefile.am
A Transceiver52M/device/xtrx/XTRXDevice.cpp
A Transceiver52M/device/xtrx/XTRXDevice.h
M configure.ac
M contrib/systemd/Makefile.am
A contrib/systemd/osmo-trx-xtrx.service
M debian/control
A debian/osmo-trx-xtrx.install
M doc/examples/Makefile.am
A doc/examples/osmo-trx-xtrx/osmo-trx-xtrx.cfg
12 files changed, 735 insertions(+), 0 deletions(-)



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

diff --git a/Transceiver52M/Makefile.am b/Transceiver52M/Makefile.am
index ade4e30..2f636f4 100644
--- a/Transceiver52M/Makefile.am
+++ b/Transceiver52M/Makefile.am
@@ -104,3 +104,13 @@
$(LMS_LIBS)
 osmo_trx_lms_CPPFLAGS  = $(AM_CPPFLAGS) $(LMS_CFLAGS)
 endif
+
+if DEVICE_XTRX
+bin_PROGRAMS += osmo-trx-xtrx
+osmo_trx_xtrx_SOURCES = osmo-trx.cpp
+osmo_trx_xtrx_LDADD = \
+   $(builddir)/device/xtrx/libdevice.la \
+   $(COMMON_LDADD) \
+   $(XTRX_LIBS)
+osmo_trx_xtrx_CPPFLAGS  = $(AM_CPPFLAGS) $(XTRX_CFLAGS)
+endif
diff --git a/Transceiver52M/device/Makefile.am 
b/Transceiver52M/device/Makefile.am
index 369e877..8460a96 100644
--- a/Transceiver52M/device/Makefile.am
+++ b/Transceiver52M/device/Makefile.am
@@ -13,3 +13,7 @@
 if DEVICE_LMS
 SUBDIRS += lms
 endif
+
+if DEVICE_XTRX
+SUBDIRS += xtrx
+endif
diff --git a/Transceiver52M/device/xtrx/Makefile.am 
b/Transceiver52M/device/xtrx/Makefile.am
new file mode 100644
index 000..2b99b39
--- /dev/null
+++ b/Transceiver52M/device/xtrx/Makefile.am
@@ -0,0 +1,10 @@
+include $(top_srcdir)/Makefile.common
+
+AM_CPPFLAGS = -Wall $(STD_DEFINES_AND_INCLUDES) -I${srcdir}/../common
+AM_CXXFLAGS = -lpthread $(LIBOSMOCORE_CFLAGS) $(LIBOSMOCTRL_CFLAGS) 
$(LIBOSMOVTY_CFLAGS)
+
+noinst_HEADERS = XTRXDevice.h
+
+noinst_LTLIBRARIES = libdevice.la
+
+libdevice_la_SOURCES = XTRXDevice.cpp
diff --git a/Transceiver52M/device/xtrx/XTRXDevice.cpp 
b/Transceiver52M/device/xtrx/XTRXDevice.cpp
new file mode 100644
index 000..27192bb
--- /dev/null
+++ b/Transceiver52M/device/xtrx/XTRXDevice.cpp
@@ -0,0 +1,455 @@
+/*
+* Copyright 2018 Sergey Kostanbaev 
+*
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Affero General Public License as 
published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Affero General Public License for more details.
+
+   You should have received a copy of the GNU Affero General Public License
+   along with this program.  If not, see .
+*/
+
+
+#include 
+#include 
+#include 
+#include "Threads.h"
+#include "XTRXDevice.h"
+
+#include 
+#include 
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+using namespace std;
+
+const double defaultRXBandwidth = 0.5e6;
+const double defaultTXBandwidth = 1.5e6;
+
+static int time_tx_corr = 60; //20+20+20+20+20;
+
+XTRXDevice::XTRXDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, 
size_t chans, double lo_offset,
+  const std::vector& 
tx_paths,
+  const std::vector& 
rx_paths) :
+   RadioDevice(tx_sps, rx_sps, iface, chans, lo_offset, tx_paths, rx_paths)
+{
+   LOG(INFO) << "creating XTRX device:"
+ << " RXSPS: " << rx_sps
+ << " TXSPS: " << tx_sps
+ << " chans: " << chans
+ << " lo_off: " << lo_offset
+ << " rx_path(0): " << (rx_paths.size() ? rx_paths[0] 
: "<>")
+ << " tx_path(0): " << (tx_paths.size() ? tx_paths[0] 
: "<>");
+
+   txsps = tx_sps;
+   rxsps = rx_sps;
+
+   rxGain = 0;
+   txGain = 0;
+
+   loopback = false;
+   device = NULL;
+}
+
+static int parse_config(const char* line, const char* argument, int 
default_value)
+{
+   const char* arg_found = strstr(line, argument);
+   if (!arg_found)
+   return default_value;
+
+   const char* qe_pos = strchr(arg_found, '=');
+   if (!qe_pos)
+   return default_value;
+
+   int res = strtol(qe_pos + 1, NULL, 10);
+   if (res == 0 && errno) {
+   return default_value;
+   }
+
+   return res;
+}
+
+int XTRXDevice::open(const std::string , int ref, bool swap_channels)
+{
+   LOG(INFO) << "opening XTRX 

Change in ...osmo-pcu[master]: pcu_l1_if.cpp: Fix GSMTAP Imm Assign PCH wrong encoding

2019-10-07 Thread pespin
pespin has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15682 )

Change subject: pcu_l1_if.cpp: Fix GSMTAP Imm Assign PCH wrong encoding
..

pcu_l1_if.cpp: Fix GSMTAP Imm Assign PCH wrong encoding

Wireshark expects to receive the plen in order to decode it.

Fixes: 58543709e422ce6ba20baa232e6a5aced9b99164
Change-Id: I91d1354689300b949760cdbaee03294eab958e12
---
M src/pcu_l1_if.cpp
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved



diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index ac04663..6a0d58e 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -238,7 +238,7 @@
data[3] = (plen << 2) | 0x01;

if (bts->gsmtap_categ_mask & (1 << PCU_GSMTAP_C_DL_PCH))
-   gsmtap_send(bts->gsmtap, 0, 0, GSMTAP_CHANNEL_PCH, 0, 0, 0, 0, 
data + 4, 23);
+   gsmtap_send(bts->gsmtap, 0, 0, GSMTAP_CHANNEL_PCH, 0, 0, 0, 0, 
data + 3, 23);

pcu_tx_data_req(0, 0, PCU_IF_SAPI_PCH, 0, 0, 0, data, 23+3);
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15682
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I91d1354689300b949760cdbaee03294eab958e12
Gerrit-Change-Number: 15682
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in ...osmo-pcu[master]: pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items

2019-10-07 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15683 )

Change subject: pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items
..


Patch Set 1:

(5 comments)

https://gerrit.osmocom.org/#/c/15683/1/src/pcu_l1_if.cpp
File src/pcu_l1_if.cpp:

https://gerrit.osmocom.org/#/c/15683/1/src/pcu_l1_if.cpp@a212
PS1, Line 212:
Unrelated ws fix.


https://gerrit.osmocom.org/#/c/15683/1/src/pcu_l1_if.cpp@226
PS1, Line 226: 1 + 22
I would not separate PLEN from Immediate Assignment, it's a mandatory part of 
that message. To me 3 + 23 looks cleaner, because I know that 23 is the default 
GSM MAC block length. Moreover, I would use GSM_MACBLOCK_LEN macro here.


https://gerrit.osmocom.org/#/c/15683/1/src/pcu_l1_if.cpp@237
PS1, Line 237: 3 + 1
Here it's logical (maybe worth adding a comment): we skip 3 octets of paging 
group, and the first octet of the MAC block (Immediate Assignment message), 
because bitvec_pack() does not write plen for us.


https://gerrit.osmocom.org/#/c/15683/1/src/pcu_l1_if.cpp@241
PS1, Line 241: 1 + 22
GSM_MACBLOCK_LEN


https://gerrit.osmocom.org/#/c/15683/1/src/pcu_l1_if.cpp@243
PS1, Line 243: 1 + 22
GSM_MACBLOCK_LEN



--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15683
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I32876858e3e93951e965b0fc7875c95c1f36f3ac
Gerrit-Change-Number: 15683
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria 
Gerrit-Comment-Date: Mon, 07 Oct 2019 16:45:33 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...osmo-pcu[master]: pcu_l1_if.cpp: Fix GSMTAP Imm Assign PCH wrong encoding

2019-10-07 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15682 )

Change subject: pcu_l1_if.cpp: Fix GSMTAP Imm Assign PCH wrong encoding
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15682
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I91d1354689300b949760cdbaee03294eab958e12
Gerrit-Change-Number: 15682
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Comment-Date: Mon, 07 Oct 2019 16:36:42 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-pcu[master]: pcu_l1_if.cpp: Fix GSMTAP Imm Assign PCH wrong encoding

2019-10-07 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15682


Change subject: pcu_l1_if.cpp: Fix GSMTAP Imm Assign PCH wrong encoding
..

pcu_l1_if.cpp: Fix GSMTAP Imm Assign PCH wrong encoding

Wireshark expects to receive the plen in order to decode it.

Fixes: 58543709e422ce6ba20baa232e6a5aced9b99164
Change-Id: I91d1354689300b949760cdbaee03294eab958e12
---
M src/pcu_l1_if.cpp
1 file changed, 1 insertion(+), 1 deletion(-)



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

diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index ac04663..6a0d58e 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -238,7 +238,7 @@
data[3] = (plen << 2) | 0x01;

if (bts->gsmtap_categ_mask & (1 << PCU_GSMTAP_C_DL_PCH))
-   gsmtap_send(bts->gsmtap, 0, 0, GSMTAP_CHANNEL_PCH, 0, 0, 0, 0, 
data + 4, 23);
+   gsmtap_send(bts->gsmtap, 0, 0, GSMTAP_CHANNEL_PCH, 0, 0, 0, 0, 
data + 3, 23);

pcu_tx_data_req(0, 0, PCU_IF_SAPI_PCH, 0, 0, 0, data, 23+3);
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15682
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I91d1354689300b949760cdbaee03294eab958e12
Gerrit-Change-Number: 15682
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-MessageType: newchange


Change in ...osmo-pcu[master]: pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items

2019-10-07 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/15683


Change subject: pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items
..

pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items

Change-Id: I32876858e3e93951e965b0fc7875c95c1f36f3ac
---
M src/pcu_l1_if.cpp
1 file changed, 6 insertions(+), 6 deletions(-)



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

diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 6a0d58e..70d76f7 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -209,7 +209,7 @@
 {
struct gprs_rlcmac_bts *bts = bts_main_data();
uint8_t data[23]; /* prefix PLEN */
-
+
/* FIXME: why does OpenBTS has no PLEN and no fill in message? */
bitvec_pack(block, data + 1);
data[0] = (plen << 2) | 0x01;
@@ -223,7 +223,7 @@
 void pcu_l1if_tx_pch(bitvec * block, int plen, const char *imsi)
 {
struct gprs_rlcmac_bts *bts = bts_main_data();
-   uint8_t data[3+1+23]; /* prefix PLEN */
+   uint8_t data[3 + 1 + 22]; /* paging group + PLEN + imm assign */

/* paging group */
if (!imsi || strlen(imsi) < 3)
@@ -233,14 +233,14 @@
data[1] = imsi[1];
data[2] = imsi[2];

-   OSMO_ASSERT(block->data_len <= sizeof(data) - (3+1));
-   bitvec_pack(block, data + 3+1);
+   OSMO_ASSERT(block->data_len <= sizeof(data) - (3 + 1));
+   bitvec_pack(block, data + 3 + 1);
data[3] = (plen << 2) | 0x01;

if (bts->gsmtap_categ_mask & (1 << PCU_GSMTAP_C_DL_PCH))
-   gsmtap_send(bts->gsmtap, 0, 0, GSMTAP_CHANNEL_PCH, 0, 0, 0, 0, 
data + 3, 23);
+   gsmtap_send(bts->gsmtap, 0, 0, GSMTAP_CHANNEL_PCH, 0, 0, 0, 0, 
data + 3, 1 + 22);

-   pcu_tx_data_req(0, 0, PCU_IF_SAPI_PCH, 0, 0, 0, data, 23+3);
+   pcu_tx_data_req(0, 0, PCU_IF_SAPI_PCH, 0, 0, 0, data, 3 + 1 + 22);
 }

 extern "C" void pcu_rx_block_time(uint16_t arfcn, uint32_t fn, uint8_t ts_no)

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15683
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I32876858e3e93951e965b0fc7875c95c1f36f3ac
Gerrit-Change-Number: 15683
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-MessageType: newchange


Change in ...osmo-ttcn3-hacks[master]: WIP

2019-10-07 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15681


Change subject: WIP
..

WIP

Change-Id: I3be5123ff5294e5851652ec14d54589442082b28
---
M pcu/PCU_Tests_RAW.ttcn
1 file changed, 55 insertions(+), 0 deletions(-)



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

diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn
index 0771cf9..e9003d3 100644
--- a/pcu/PCU_Tests_RAW.ttcn
+++ b/pcu/PCU_Tests_RAW.ttcn
@@ -1017,6 +1017,60 @@
f_rx_rlcmac_dl_block_exp_dummy(dl_block);
 }

+/* pespin */
+testcase TC_pespin() runs on RAW_PCU_Test_CT {
+   var PCUIF_info_ind info_ind;
+   var GsmRrMessage rr_imm_ass;
+   var PacketUlAssign ul_tbf_ass;
+   var RlcmacDlBlock dl_block;
+   var PCUIF_Message pcu_msg;
+   var octetstring data;
+   var boolean ok;
+   var OCT4 tlli := '0001'O;
+
+   /* Initialize NS/BSSGP side */
+   f_init_bssgp();
+
+   info_ind := valueof(ts_PCUIF_INFO_default);
+   /* Set timer to 1 sec (default 5) to speedup test: */
+   info_ind.t3169 := 1;
+
+   /* Initialize the PCU interface abstraction */
+   f_init_raw(testcasename(), info_ind);
+
+   /* Establish BSSGP connection to the PCU */
+   f_bssgp_establish();
+   f_bssgp_client_llgmm_assign(''O, tlli);
+
+   /* Establish an Uplink TBF */
+   ok := f_establish_tbf(rr_imm_ass);
+   if (not ok) {
+   setverdict(fail, "Failed to establish TBF");
+   mtc.stop;
+   }
+
+   ok := f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
+   if (not ok) {
+   setverdict(fail, "Immediate Assignment not an Uplink TBF");
+   mtc.stop;
+   }
+
+   /* Send one UL block and make sure it is ACKED fine */
+   f_tx_rlcmac_ul_n_blocks(ul_tbf_ass, 1);
+   f_rx_rlcmac_dl_block_exp_ack_nack(dl_block);
+   /* UL block should be received in SGSN */
+   BSSGP[0].receive(tr_BSSGP_UL_UD(tlli, mp_gb_cfg.cell_id));
+
+   /* Wait until T3169 fires (plus 1 extra sec to make sure) */
+   f_sleep(int2float(info_ind.t3169) + 1.0);
+
+   /* Send an UL block once again, the TBF should be gone by now so no ACK 
*/
+   f_tx_rlcmac_ul_n_blocks(ul_tbf_ass, 1);
+   f_rx_rlcmac_dl_block_exp_dummy(dl_block);
+
+   f_sleep(10.0);
+}
+

 control {
execute( TC_ns_reset() );
@@ -1034,6 +1088,7 @@
execute( TC_ta_ptcch_ul_multi_tbf() );
execute( TC_cs_lqual_ul_tbf() );
execute( TC_t3169() );
+   execute( TC_pespin() );
 }



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15681
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I3be5123ff5294e5851652ec14d54589442082b28
Gerrit-Change-Number: 15681
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-MessageType: newchange


Change in ...osmo-ttcn3-hacks[master]: pcu: TC_t3169: Check ul block reaches SGSN before timer expiration

2019-10-07 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15680


Change subject: pcu: TC_t3169: Check ul block reaches SGSN before timer 
expiration
..

pcu: TC_t3169: Check ul block reaches SGSN before timer expiration

Change-Id: Ic6fd82dc5037d08278d36aed9b6e72e80da5c42f
---
M pcu/PCU_Tests_RAW.ttcn
1 file changed, 10 insertions(+), 0 deletions(-)



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

diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn
index f0c8b1d..0771cf9 100644
--- a/pcu/PCU_Tests_RAW.ttcn
+++ b/pcu/PCU_Tests_RAW.ttcn
@@ -974,6 +974,10 @@
var PCUIF_Message pcu_msg;
var octetstring data;
var boolean ok;
+   var OCT4 tlli := '0001'O;
+
+   /* Initialize NS/BSSGP side */
+   f_init_bssgp();

info_ind := valueof(ts_PCUIF_INFO_default);
/* Set timer to 1 sec (default 5) to speedup test: */
@@ -982,6 +986,10 @@
/* Initialize the PCU interface abstraction */
f_init_raw(testcasename(), info_ind);

+   /* Establish BSSGP connection to the PCU */
+   f_bssgp_establish();
+   f_bssgp_client_llgmm_assign(''O, tlli);
+
/* Establish an Uplink TBF */
ok := f_establish_tbf(rr_imm_ass);
if (not ok) {
@@ -998,6 +1006,8 @@
/* Send one UL block and make sure it is ACKED fine */
f_tx_rlcmac_ul_n_blocks(ul_tbf_ass, 1);
f_rx_rlcmac_dl_block_exp_ack_nack(dl_block);
+   /* UL block should be received in SGSN */
+   BSSGP[0].receive(tr_BSSGP_UL_UD(tlli, mp_gb_cfg.cell_id));

/* Wait until T3169 fires (plus 1 extra sec to make sure) */
f_sleep(int2float(info_ind.t3169) + 1.0);

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15680
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ic6fd82dc5037d08278d36aed9b6e72e80da5c42f
Gerrit-Change-Number: 15680
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-MessageType: newchange


Change in ...libosmocore[master]: tdef: Introduce min_val and max_val fields

2019-10-07 Thread pespin
pespin has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/libosmocore/+/15546 )

Change subject: tdef: Introduce min_val and max_val fields
..

tdef: Introduce min_val and max_val fields

This is useful for timers expected to have a range of valid or expected
values.

Validation is done at runtime when timer values are set by the app or by
the user through the VTY.

Related: OS#4190
Change-Id: I4661ac41c29a009a1d5fc57d87aaee6041c7d1b2
---
M TODO-RELEASE
M include/osmocom/core/tdef.h
M src/tdef.c
M src/vty/tdef_vty.c
M tests/tdef/tdef_test.c
M tests/tdef/tdef_test.ok
M tests/tdef/tdef_vty_test_config_root.c
M tests/tdef/tdef_vty_test_config_root.vty
8 files changed, 175 insertions(+), 13 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  fixeria: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/TODO-RELEASE b/TODO-RELEASE
index 665ecf7..547b5a9 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -8,3 +8,4 @@
 # If any interfaces have been removed or changed since the last public 
release: c:r:0.
 #library   whatdescription / commit summary line
 core   osmo_tdef_get() change val_if_not_present arg from 
unsigned long to long to allow passing -1
+core   struct osmo_tdeffields min_val,max_val added, ABI break 
(arrays of structs used in programs)
diff --git a/include/osmocom/core/tdef.h b/include/osmocom/core/tdef.h
index 8155688..54819d9 100644
--- a/include/osmocom/core/tdef.h
+++ b/include/osmocom/core/tdef.h
@@ -77,6 +77,10 @@
/*! Currently active timeout value, e.g. set by user config. This is 
the only mutable member: a user may
 * configure the timeout value, but neither unit nor any other field. */
unsigned long val;
+   /*! Minimum timer value (in this tdef unit), checked if set (not zero). 
*/
+   unsigned long min_val;
+   /*! Maximum timer value (in this tdef unit), checked if set (not zero). 
*/
+   unsigned long max_val;
 };

 /*! Iterate an array of struct osmo_tdef, the last item should be fully zero, 
i.e. "{}".
@@ -98,6 +102,8 @@
long val_if_not_present);
 struct osmo_tdef *osmo_tdef_get_entry(struct osmo_tdef *tdefs, int T);
 int osmo_tdef_set(struct osmo_tdef *tdefs, int T, unsigned long val, enum 
osmo_tdef_unit val_unit);
+bool osmo_tdef_val_in_range(struct osmo_tdef *tdef, unsigned long new_val);
+int osmo_tdef_range_str_buf(char *buf, size_t buf_len, struct osmo_tdef *t);

 /*! Using osmo_tdef for osmo_fsm_inst: array entry for a mapping of state 
numbers to timeout definitions.
  * For a usage example, see osmo_tdef_get_state_timeout() and 
test_tdef_state_timeout() in tdef_test.c. */
diff --git a/src/tdef.c b/src/tdef.c
index ab6a51b..94d987f 100644
--- a/src/tdef.c
+++ b/src/tdef.c
@@ -136,14 +136,22 @@

 /*! Set all osmo_tdef values to the default_val.
  * It is convenient to define a tdefs array by setting only the default_val, 
and calling osmo_tdefs_reset() once for
- * program startup. (See also osmo_tdef_vty_init())
+ * program startup. (See also osmo_tdef_vty_init()).
+ * During call to this function, default values are verified to be inside 
valid range; process is aborted otherwise.
  * \param[in] tdefs  Array of timer definitions, last entry being fully zero.
  */
 void osmo_tdefs_reset(struct osmo_tdef *tdefs)
 {
struct osmo_tdef *t;
-   osmo_tdef_for_each(t, tdefs)
+   osmo_tdef_for_each(t, tdefs) {
+   if (!osmo_tdef_val_in_range(t, t->default_val)) {
+   char range_str[64];
+   osmo_tdef_range_str_buf(range_str, sizeof(range_str), 
t);
+   osmo_panic("%s:%d Timer " OSMO_T_FMT " contains default 
value %lu not in range %s\n",
+  __FILE__, __LINE__, OSMO_T_FMT_ARGS(t->T), 
t->default_val, range_str);
+   }
t->val = t->default_val;
+   }
 }

 /*! Return the value of a T timer from a list of osmo_tdef, in the given unit.
@@ -221,13 +229,55 @@
  */
 int osmo_tdef_set(struct osmo_tdef *tdefs, int T, unsigned long val, enum 
osmo_tdef_unit val_unit)
 {
+   unsigned long new_val;
struct osmo_tdef *t = osmo_tdef_get_entry(tdefs, T);
if (!t)
return -EEXIST;
-   t->val = osmo_tdef_round(val, val_unit, t->unit);
+
+   new_val = osmo_tdef_round(val, val_unit, t->unit);
+   if (!osmo_tdef_val_in_range(t, new_val))
+   return -ERANGE;
+
+   t->val = new_val;
return 0;
 }

+/*! Check if value new_val is in range of valid possible values for timer 
entry tdef.
+ * \param[in] tdef  Timer entry from a timer definition table.
+ * \param[in] new_val  The value whose validity to check, in units as per this 
timer entry.
+ * \return true if inside 

Change in ...libosmocore[master]: tdef_test: verify case where osmo_tdef_set returns -EEXIST

2019-10-07 Thread pespin
pespin has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/libosmocore/+/15563 )

Change subject: tdef_test: verify case where osmo_tdef_set returns -EEXIST
..

tdef_test: verify case where osmo_tdef_set returns -EEXIST

Change-Id: I436daa804aac11622fde24afe9ea35193d9e9beb
---
M tests/tdef/tdef_test.c
M tests/tdef/tdef_test.ok
2 files changed, 4 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  fixeria: Looks good to me, approved
  osmith: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/tests/tdef/tdef_test.c b/tests/tdef/tdef_test.c
index 60066b1..276330a 100644
--- a/tests/tdef/tdef_test.c
+++ b/tests/tdef/tdef_test.c
@@ -179,6 +179,9 @@
print_tdef_get_short(tdefs, 7, OSMO_TDEF_M);
print_tdef_get_short(tdefs, 7, OSMO_TDEF_CUSTOM);

+   printf("setting 23 = 50 (EEXIST)\n");
+   OSMO_ASSERT(osmo_tdef_set(tdefs, 23, 50, OSMO_TDEF_S) == -EEXIST);
+
printf("resetting\n");
osmo_tdefs_reset(tdefs);
print_tdef_info(7);
diff --git a/tests/tdef/tdef_test.ok b/tests/tdef/tdef_test.ok
index 2a3617e..3c4a093 100644
--- a/tests/tdef/tdef_test.ok
+++ b/tests/tdef/tdef_test.ok
@@ -117,6 +117,7 @@
 osmo_tdef_get(7, s)= 420
 osmo_tdef_get(7, m)= 7
 osmo_tdef_get(7, custom-unit)  = 420
+setting 23 = 50 (EEXIST)
 resetting
 T7=50s
 osmo_tdef_get(7, s)= 50

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I436daa804aac11622fde24afe9ea35193d9e9beb
Gerrit-Change-Number: 15563
Gerrit-PatchSet: 7
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in ...libosmocore[master]: tdef: Introduce min_val and max_val fields

2019-10-07 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/15546 )

Change subject: tdef: Introduce min_val and max_val fields
..


Patch Set 7: Code-Review+2


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4661ac41c29a009a1d5fc57d87aaee6041c7d1b2
Gerrit-Change-Number: 15546
Gerrit-PatchSet: 7
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 13:14:10 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...libosmocore[master]: tdef: Introduce min_val and max_val fields

2019-10-07 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/15546 )

Change subject: tdef: Introduce min_val and max_val fields
..


Patch Set 7: Code-Review+1


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4661ac41c29a009a1d5fc57d87aaee6041c7d1b2
Gerrit-Change-Number: 15546
Gerrit-PatchSet: 7
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 13:07:58 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce test TC_t3169

2019-10-07 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15676 )

Change subject: pcu: Introduce test TC_t3169
..


Patch Set 5: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15676
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I587413a7de7956daee3423057530e4052a55ba88
Gerrit-Change-Number: 15676
Gerrit-PatchSet: 5
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 13:01:09 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce func helper f_imm_ass_verify_ul_tbf_ass()

2019-10-07 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15675 )

Change subject: pcu: Introduce func helper f_imm_ass_verify_ul_tbf_ass()
..


Patch Set 4: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15675
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5b8a7ca5a4d0f905bf68949978811b139568c237
Gerrit-Change-Number: 15675
Gerrit-PatchSet: 4
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 12:54:27 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: pcu: Allow tests to overwrite pcuif INFO_IND params

2019-10-07 Thread fixeria
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15674 )

Change subject: pcu: Allow tests to overwrite pcuif INFO_IND params
..


Patch Set 3: Code-Review+1

Much better now.


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15674
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I75c746b822184fdcc966d77a7c6a0a6918c236e6
Gerrit-Change-Number: 15674
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 12:51:47 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce some function helpers

2019-10-07 Thread pespin
pespin has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15664 )

Change subject: pcu: Introduce some function helpers
..

pcu: Introduce some function helpers

Change-Id: I8608fac4375153d5020df5d05026513a7fe931d6
---
M pcu/PCU_Tests_RAW.ttcn
1 file changed, 49 insertions(+), 18 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  osmith: Looks good to me, approved



diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn
index b5aec76..4d20027 100644
--- a/pcu/PCU_Tests_RAW.ttcn
+++ b/pcu/PCU_Tests_RAW.ttcn
@@ -552,6 +552,53 @@
return false;
 }

+/* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */
+private function f_pcuif_tx_data_ind(octetstring data, int16_t lqual_cb := 0)
+runs on RAW_PCU_Test_CT {
+
+   BTS.send(ts_PCUIF_DATA_IND(bts_nr := 0, trx_nr := 0, ts_nr := 7, 
block_nr := 0,
+  sapi := PCU_IF_SAPI_PDTCH, data := data,
+  fn := 0, arfcn := 871, lqual_cb := 
lqual_cb));
+   BTS.receive(tr_RAW_PCU_EV(TDMA_EV_PDTCH_BLOCK_SENT));
+}
+
+/* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */
+private function f_pcuif_rx_data_req(out PCUIF_Message pcu_msg)
+runs on RAW_PCU_Test_CT {
+   BTS.send(ts_PCUIF_RTS_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7,
+ sapi := PCU_IF_SAPI_PDTCH, fn := 0,
+ arfcn := 871, block_nr := 0));
+   BTS.receive(tr_PCUIF_DATA_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7,
+ sapi := PCU_IF_SAPI_PDTCH)) -> value 
pcu_msg;
+}
+
+private function f_tx_rlcmac_ul_block(template (value) RlcmacUlBlock ul_data, 
int16_t lqual_cb := 0)
+runs on RAW_PCU_Test_CT {
+   var octetstring data;
+   /* Encode the payload of DATA.ind */
+   data := enc_RlcmacUlBlock(valueof(ul_data));
+   data := f_pad_oct(data, 23, '00'O); /* CS-1 */
+
+   /* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */
+   f_pcuif_tx_data_ind(data, lqual_cb);
+}
+
+private function f_rx_rlcmac_dl_block(out RlcmacDlBlock dl_block)
+runs on RAW_PCU_Test_CT {
+   var PCUIF_Message pcu_msg;
+   f_pcuif_rx_data_req(pcu_msg);
+   dl_block := dec_RlcmacDlBlock(pcu_msg.u.data_req.data);
+}
+
+private function f_rx_rlcmac_dl_block_exp_ack_nack(out RlcmacDlBlock dl_block)
+runs on RAW_PCU_Test_CT {
+   f_rx_rlcmac_dl_block(dl_block);
+   if (not match(dl_block, tr_RLCMAC_ACK_NACK(ul_tfi := ?, tlli := ?))) {
+   setverdict(fail, "Failed to match Packet Uplink ACK / NACK");
+   mtc.stop;
+   }
+}
+
 testcase TC_pcuif_suspend() runs on RAW_PCU_Test_CT {
var octetstring ra_id := 
enc_RoutingAreaIdentification(mp_gb_cfg.cell_id.ra_id);
var GprsTlli tlli := ''O;
@@ -851,31 +898,15 @@
ul_data.data.mac_hdr.countdown := (15 - i);
ul_data.data.blocks := { 
valueof(t_RLCMAC_LLCBLOCK(f_rnd_octstring(10))) };

-   /* Encode the payload of DATA.ind */
-   data := enc_RlcmacUlBlock(valueof(ul_data));
-   data := f_pad_oct(data, 23, '00'O); /* CS-1 */
-
/* Link quality in dB and our CS1-4 expectations */
var integer lqual := i * 2;

/* Enqueue DATA.ind (both TDMA frame and block numbers to be 
patched) */
log("Sending DATA.ind with link quality (dB): ", lqual);
-   BTS.send(ts_PCUIF_DATA_IND(bts_nr := 0, trx_nr := 0, ts_nr := 
7, block_nr := 0,
-  sapi := PCU_IF_SAPI_PDTCH, data := 
data,
-  fn := 0, arfcn := 871, lqual_cb := 
lqual * 10));
-   BTS.receive(tr_RAW_PCU_EV(TDMA_EV_PDTCH_BLOCK_SENT));
+   f_tx_rlcmac_ul_block(ul_data, lqual * 10);

/* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */
-   BTS.send(ts_PCUIF_RTS_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7,
- sapi := PCU_IF_SAPI_PDTCH, fn := 0,
- arfcn := 871, block_nr := 0));
-   BTS.receive(tr_PCUIF_DATA_REQ(bts_nr := 0, trx_nr := 0, ts_nr 
:= 7,
- sapi := PCU_IF_SAPI_PDTCH)) -> 
value pcu_msg;
-   dl_block := dec_RlcmacDlBlock(pcu_msg.u.data_req.data);
-   if (not match(dl_block, tr_RLCMAC_ACK_NACK(ul_tfi := ?, tlli := 
?))) {
-   setverdict(fail, "Failed to match Packet Uplink ACK / 
NACK");
-   mtc.stop;
-   }
+   f_rx_rlcmac_dl_block_exp_ack_nack(dl_block);

log("Rx Packet Uplink ACK / NACK with Channel Coding Command: ",

Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce some function helpers

2019-10-07 Thread osmith
osmith has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15664 )

Change subject: pcu: Introduce some function helpers
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15664
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I8608fac4375153d5020df5d05026513a7fe931d6
Gerrit-Change-Number: 15664
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 11:39:20 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: pcu: Allow tests to overwrite pcuif INFO_IND params

2019-10-07 Thread pespin
Hello fixeria, laforge, osmith, Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15674

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

Change subject: pcu: Allow tests to overwrite pcuif INFO_IND params
..

pcu: Allow tests to overwrite pcuif INFO_IND params

Change-Id: I75c746b822184fdcc966d77a7c6a0a6918c236e6
---
M library/PCUIF_Types.ttcn
M pcu/PCU_Tests_RAW.ttcn
2 files changed, 47 insertions(+), 99 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/74/15674/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15674
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I75c746b822184fdcc966d77a7c6a0a6918c236e6
Gerrit-Change-Number: 15674
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: newpatchset


Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce test TC_t3169

2019-10-07 Thread pespin
Hello fixeria, laforge, osmith, Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15676

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

Change subject: pcu: Introduce test TC_t3169
..

pcu: Introduce test TC_t3169

Related: OS#3928
Change-Id: I587413a7de7956daee3423057530e4052a55ba88
---
M library/RLCMAC_Types.ttcn
M pcu/PCU_Tests_RAW.ttcn
2 files changed, 93 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/76/15676/5
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15676
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I587413a7de7956daee3423057530e4052a55ba88
Gerrit-Change-Number: 15676
Gerrit-PatchSet: 5
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: newpatchset


Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce test TC_t3169

2019-10-07 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15676 )

Change subject: pcu: Introduce test TC_t3169
..


Patch Set 4: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15676
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I587413a7de7956daee3423057530e4052a55ba88
Gerrit-Change-Number: 15676
Gerrit-PatchSet: 4
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 10:27:27 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce func helper f_imm_ass_verify_ul_tbf_ass()

2019-10-07 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15675 )

Change subject: pcu: Introduce func helper f_imm_ass_verify_ul_tbf_ass()
..


Patch Set 3: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15675
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5b8a7ca5a4d0f905bf68949978811b139568c237
Gerrit-Change-Number: 15675
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 10:26:28 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: pcu: Allow tests to overwrite pcuif INFO_IND params

2019-10-07 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15674 )

Change subject: pcu: Allow tests to overwrite pcuif INFO_IND params
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/15674/1/pcu/PCU_Tests_RAW.ttcn
File pcu/PCU_Tests_RAW.ttcn:

https://gerrit.osmocom.org/#/c/15674/1/pcu/PCU_Tests_RAW.ttcn@72
PS1, Line 72: f_default_pcuif_info_ind
> I tried doing so now, but it cannot be done as easily as you though: […]
I think you can use "mp" (modulepar) values as well as other (compatible) 
templates when assigning values to template fields.  However, what you cannot 
do is to use function return vaules.  Just think of initializing a global 
static variable in C, where also all values must be known at compile time.

I also don't like the "function" approach and would prefer a template, if 
possible in some way.  My expectation is that if you don't intend to create a 
"const" value, a normal template (value) definition should just work.



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15674
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I75c746b822184fdcc966d77a7c6a0a6918c236e6
Gerrit-Change-Number: 15674
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 10:25:57 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin 
Comment-In-Reply-To: fixeria 
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce some function helpers

2019-10-07 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15664 )

Change subject: pcu: Introduce some function helpers
..


Patch Set 3: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15664
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I8608fac4375153d5020df5d05026513a7fe931d6
Gerrit-Change-Number: 15664
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 10:21:41 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce test TC_t3169

2019-10-07 Thread pespin
Hello fixeria, laforge, osmith, Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15676

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

Change subject: pcu: Introduce test TC_t3169
..

pcu: Introduce test TC_t3169

Related: OS#3928
Change-Id: I587413a7de7956daee3423057530e4052a55ba88
---
M library/RLCMAC_Types.ttcn
M pcu/PCU_Tests_RAW.ttcn
2 files changed, 93 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/76/15676/4
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15676
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I587413a7de7956daee3423057530e4052a55ba88
Gerrit-Change-Number: 15676
Gerrit-PatchSet: 4
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: newpatchset


Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce func helper f_imm_ass_verify_ul_tbf_ass()

2019-10-07 Thread pespin
Hello fixeria, laforge, osmith, Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15675

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

Change subject: pcu: Introduce func helper f_imm_ass_verify_ul_tbf_ass()
..

pcu: Introduce func helper f_imm_ass_verify_ul_tbf_ass()

Change-Id: I5b8a7ca5a4d0f905bf68949978811b139568c237
---
M pcu/PCU_Tests_RAW.ttcn
1 file changed, 28 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/75/15675/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15675
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5b8a7ca5a4d0f905bf68949978811b139568c237
Gerrit-Change-Number: 15675
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: newpatchset


Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce test TC_t3169

2019-10-07 Thread pespin
Hello fixeria, laforge, osmith, Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15676

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

Change subject: pcu: Introduce test TC_t3169
..

pcu: Introduce test TC_t3169

Related: OS#3928
Change-Id: I587413a7de7956daee3423057530e4052a55ba88
---
M library/RLCMAC_Types.ttcn
M pcu/PCU_Tests_RAW.ttcn
2 files changed, 93 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/76/15676/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15676
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I587413a7de7956daee3423057530e4052a55ba88
Gerrit-Change-Number: 15676
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: newpatchset


Change in ...osmo-ttcn3-hacks[master]: pcu: Allow tests to overwrite pcuif INFO_IND params

2019-10-07 Thread pespin
Hello fixeria, laforge, osmith, Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15674

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

Change subject: pcu: Allow tests to overwrite pcuif INFO_IND params
..

pcu: Allow tests to overwrite pcuif INFO_IND params

Change-Id: I75c746b822184fdcc966d77a7c6a0a6918c236e6
---
M library/PCUIF_Types.ttcn
M pcu/PCU_Tests_RAW.ttcn
2 files changed, 57 insertions(+), 97 deletions(-)


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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I75c746b822184fdcc966d77a7c6a0a6918c236e6
Gerrit-Change-Number: 15674
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: newpatchset


Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce func helper f_establish_tbf_ul()

2019-10-07 Thread pespin
Hello fixeria, laforge, osmith, Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15675

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

Change subject: pcu: Introduce func helper f_establish_tbf_ul()
..

pcu: Introduce func helper f_establish_tbf_ul()

Change-Id: I5b8a7ca5a4d0f905bf68949978811b139568c237
---
M pcu/PCU_Tests_RAW.ttcn
1 file changed, 28 insertions(+), 16 deletions(-)


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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5b8a7ca5a4d0f905bf68949978811b139568c237
Gerrit-Change-Number: 15675
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: newpatchset


Change in ...osmo-bts[master]: gitignore: add oc2g generated files

2019-10-07 Thread osmith
osmith has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/15612 )

Change subject: gitignore: add oc2g generated files
..

gitignore: add oc2g generated files

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

Approvals:
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/.gitignore b/.gitignore
index 305553f..a4b794a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -47,6 +47,11 @@
 src/osmo-bts-virtual/osmo-bts-virtual
 src/osmo-bts-omldummy/osmo-bts-omldummy

+src/osmo-bts-oc2g/osmo-bts-oc2g
+src/osmo-bts-oc2g/oc2gbts-mgr
+src/osmo-bts-oc2g/oc2gbts-util
+src/osmo-bts-oc2g/misc/.dirstamp
+
 tests/atconfig
 tests/package.m4
 tests/agch/agch_test

--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15612
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I3e7af6d290988099535bab63bbc53a901d16b55f
Gerrit-Change-Number: 15612
Gerrit-PatchSet: 2
Gerrit-Owner: osmith 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce test TC_t3169

2019-10-07 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15676 )

Change subject: pcu: Introduce test TC_t3169
..


Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/#/c/15676/2/pcu/PCU_Tests_RAW.ttcn
File pcu/PCU_Tests_RAW.ttcn:

https://gerrit.osmocom.org/#/c/15676/2/pcu/PCU_Tests_RAW.ttcn@658
PS2, Line 658: f_rx_pcuif_rlcmac_dl_block_exp_dummy
> Same comment as for 15675, do we really need to create functions for such 
> basic things? IMHO, this d […]
I think it's handy once you start adding more and more tests and you end up 
having test files with 3K lines, at least we get rid of a few lines ;)
When tests start to become more complex I think it really helps because you can 
abstract implementation details (like how you are matching exactly, error 
conditions, etc.). Furthermore if you want to do more checks, you simply extend 
one part of the code instead of having to apply same change all over.



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15676
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I587413a7de7956daee3423057530e4052a55ba88
Gerrit-Change-Number: 15676
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 09:09:30 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria 
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: pcu: Allow tests to overwrite pcuif INFO_IND params

2019-10-07 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15674 )

Change subject: pcu: Allow tests to overwrite pcuif INFO_IND params
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/15674/1/pcu/PCU_Tests_RAW.ttcn
File pcu/PCU_Tests_RAW.ttcn:

https://gerrit.osmocom.org/#/c/15674/1/pcu/PCU_Tests_RAW.ttcn@72
PS1, Line 72: f_default_pcuif_info_ind
> You can do this without a function, just define a global constant instead: […]
I tried doing so now, but it cannot be done as easily as you though:

PCU_Tests_RAW.ttcn:75.17-37: error: Reference to a static value was 
expected instead of template `@PCUIF_Types.ts_PCUIF_InfoTrxs_def'
PCU_Tests_RAW.ttcn:105.17-50: error: Reference to a static value was 
expected instead of the return value of external function 
`@Native_Functions.f_inet_haddr'



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15674
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I75c746b822184fdcc966d77a7c6a0a6918c236e6
Gerrit-Change-Number: 15674
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 08:32:33 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria 
Gerrit-MessageType: comment


Change in ...libosmocore[master]: tdef: Introduce min_val and max_val fields

2019-10-07 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/15546 )

Change subject: tdef: Introduce min_val and max_val fields
..


Patch Set 7:

ping? last patch version was submitted around 10 days ago.


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I4661ac41c29a009a1d5fc57d87aaee6041c7d1b2
Gerrit-Change-Number: 15546
Gerrit-PatchSet: 7
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Mon, 07 Oct 2019 08:18:43 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment