[PATCH] osmo-pcu[master]: pcuif_proto: add version 8 features

2018-02-27 Thread lynxis lazus

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

pcuif_proto: add version 8 features

Add PCU_IF_MSG_DATA_CNF_DT and PCU_IF_SAPI_AGCH_DT to bring the
pccif_proto into sync. Both commands are required to support the
rb11 with an osmo-bsc co-located pcu.

Change-Id: Ieaf151447e5556b911be7e2483b7c154fc5ec42e
---
M include/osmocom/pcu/pcuif_proto.h
1 file changed, 19 insertions(+), 1 deletion(-)


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

diff --git a/include/osmocom/pcu/pcuif_proto.h 
b/include/osmocom/pcu/pcuif_proto.h
index be63f1a..00b7bd5 100644
--- a/include/osmocom/pcu/pcuif_proto.h
+++ b/include/osmocom/pcu/pcuif_proto.h
@@ -5,7 +5,7 @@
 
 #define PCU_SOCK_DEFAULT   "/tmp/pcu_bts"
 
-#define PCU_IF_VERSION 0x07
+#define PCU_IF_VERSION 0x08
 #define TXT_MAX_LEN128
 
 /* msg_type */
@@ -13,6 +13,7 @@
 #define PCU_IF_MSG_DATA_CNF0x01/* confirm (e.g. transmission on PCH) */
 #define PCU_IF_MSG_DATA_IND0x02/* receive data from given channel */
 #define PCU_IF_MSG_RTS_REQ 0x10/* ready to send request */
+#define PCU_IF_MSG_DATA_CNF_DT 0x11/* confirm (with direct tlli) */
 #define PCU_IF_MSG_RACH_IND0x22/* receive RACH */
 #define PCU_IF_MSG_INFO_IND0x32/* retrieve BTS info */
 #define PCU_IF_MSG_ACT_REQ 0x40/* activate/deactivate PDCH */
@@ -28,6 +29,7 @@
 #define PCU_IF_SAPI_PDTCH  0x05/* packet data/control/ccch block */
 #define PCU_IF_SAPI_PRACH  0x06/* packet random access channel */
 #define PCU_IF_SAPI_PTCCH  0x07/* packet TA control channel */
+#define PCU_IF_SAPI_AGCH_DT0x08/* assignment on AGCH but with 
additional TLLI */
 
 /* flags */
 #define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */
@@ -60,6 +62,21 @@
uint8_t sapi;
uint8_t len;
uint8_t data[162];
+   uint32_tfn;
+   uint16_tarfcn;
+   uint8_t trx_nr;
+   uint8_t ts_nr;
+   uint8_t block_nr;
+   int8_t  rssi;
+   uint16_tber10k; /* !< \brief BER in units of 0.01% */
+   int16_t ta_offs_qbits;  /* !< \brief Burst TA Offset in quarter 
bits */
+   int16_t lqual_cb;   /* !< \brief Link quality in centiBel */
+} __attribute__ ((packed));
+
+/* data confirmation with direct tlli (instead of raw mac block with tlli) */
+struct gsm_pcu_if_data_cnf_dt {
+   uint8_t sapi;
+   uint32_ttlli;
uint32_tfn;
uint16_tarfcn;
uint8_t trx_nr;
@@ -161,6 +178,7 @@
union {
struct gsm_pcu_if_data  data_req;
struct gsm_pcu_if_data  data_cnf;
+   struct gsm_pcu_if_data_cnf_dt   data_cnf_dt;
struct gsm_pcu_if_data  data_ind;
struct gsm_pcu_if_rts_req   rts_req;
struct gsm_pcu_if_rach_ind  rach_ind;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieaf151447e5556b911be7e2483b7c154fc5ec42e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 


[PATCH] osmo-bsc[master]: pcuif_proto.h: add features of version 7 (txt indication)

2018-02-27 Thread lynxis lazus

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

pcuif_proto.h: add features of version 7 (txt indication)

The txt indication has been introduced with version 7, but
forgotten to sync back to this repo.

Change-Id: Iafef7dae8b84f659a1aca1677b30a38a2e5558dc
---
M include/osmocom/bsc/pcuif_proto.h
1 file changed, 16 insertions(+), 1 deletion(-)


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

diff --git a/include/osmocom/bsc/pcuif_proto.h 
b/include/osmocom/bsc/pcuif_proto.h
index f51305f..ced783e 100644
--- a/include/osmocom/bsc/pcuif_proto.h
+++ b/include/osmocom/bsc/pcuif_proto.h
@@ -1,19 +1,23 @@
 #ifndef _PCUIF_PROTO_H
 #define _PCUIF_PROTO_H
 
+#include 
+
 #define PCU_IF_VERSION 0x08
+#define TXT_MAX_LEN128
 
 /* msg_type */
 #define PCU_IF_MSG_DATA_REQ0x00/* send data to given channel */
 #define PCU_IF_MSG_DATA_CNF0x01/* confirm (e.g. transmission on PCH) */
 #define PCU_IF_MSG_DATA_IND0x02/* receive data from given channel */
-#define PCU_IF_MSG_DATA_CNF_DT 0x11/* confirm (with direct tlli) */
 #define PCU_IF_MSG_RTS_REQ 0x10/* ready to send request */
+#define PCU_IF_MSG_DATA_CNF_DT 0x11/* confirm (with direct tlli) */
 #define PCU_IF_MSG_RACH_IND0x22/* receive RACH */
 #define PCU_IF_MSG_INFO_IND0x32/* retrieve BTS info */
 #define PCU_IF_MSG_ACT_REQ 0x40/* activate/deactivate PDCH */
 #define PCU_IF_MSG_TIME_IND0x52/* GSM time indication */
 #define PCU_IF_MSG_PAG_REQ 0x60/* paging request */
+#define PCU_IF_MSG_TXT_IND 0x70/* Text indication for BTS */
 
 /* sapi */
 #define PCU_IF_SAPI_RACH   0x01/* channel request on CCCH */
@@ -41,6 +45,16 @@
 #define PCU_IF_FLAG_MCS7   (1 << 26)
 #define PCU_IF_FLAG_MCS8   (1 << 27)
 #define PCU_IF_FLAG_MCS9   (1 << 28)
+
+enum gsm_pcu_if_text_type {
+   PCU_VERSION,
+   PCU_OML_ALERT,
+};
+
+struct gsm_pcu_if_txt_ind {
+   uint8_t type; /* gsm_pcu_if_text_type */
+   chartext[TXT_MAX_LEN]; /* Text to be transmitted to BTS */
+} __attribute__ ((packed));
 
 struct gsm_pcu_if_data {
uint8_t sapi;
@@ -166,6 +180,7 @@
struct gsm_pcu_if_data  data_ind;
struct gsm_pcu_if_rts_req   rts_req;
struct gsm_pcu_if_rach_ind  rach_ind;
+   struct gsm_pcu_if_txt_ind   txt_ind;
struct gsm_pcu_if_info_ind  info_ind;
struct gsm_pcu_if_act_req   act_req;
struct gsm_pcu_if_time_ind  time_ind;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iafef7dae8b84f659a1aca1677b30a38a2e5558dc
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-pcu[master]: pcuif_proto.h: fix whitespaces and indention

2018-02-27 Thread lynxis lazus

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

pcuif_proto.h: fix whitespaces and indention

Change-Id: I290967346af4e2707cfdfb62dccaccd43d195443
---
M include/osmocom/pcu/pcuif_proto.h
1 file changed, 5 insertions(+), 5 deletions(-)


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

diff --git a/include/osmocom/pcu/pcuif_proto.h 
b/include/osmocom/pcu/pcuif_proto.h
index 39103ee..be63f1a 100644
--- a/include/osmocom/pcu/pcuif_proto.h
+++ b/include/osmocom/pcu/pcuif_proto.h
@@ -11,7 +11,7 @@
 /* msg_type */
 #define PCU_IF_MSG_DATA_REQ0x00/* send data to given channel */
 #define PCU_IF_MSG_DATA_CNF0x01/* confirm (e.g. transmission on PCH) */
-#define PCU_IF_MSG_DATA_IND0x02/* receive data from given channel */   
+#define PCU_IF_MSG_DATA_IND0x02/* receive data from given channel */
 #define PCU_IF_MSG_RTS_REQ 0x10/* ready to send request */
 #define PCU_IF_MSG_RACH_IND0x22/* receive RACH */
 #define PCU_IF_MSG_INFO_IND0x32/* retrieve BTS info */
@@ -66,9 +66,9 @@
uint8_t ts_nr;
uint8_t block_nr;
int8_t  rssi;
-   uint16_t ber10k;/*!< \brief BER in units of 0.01% */
-   int16_t ta_offs_qbits;  /* !< \brief Burst TA Offset in quarter bits */
-   int16_t lqual_cb;   /* !< \brief Link quality in centiBel */
+   uint16_tber10k; /* !< \brief BER in units of 0.01% */
+   int16_t ta_offs_qbits;  /* !< \brief Burst TA Offset in quarter 
bits */
+   int16_t lqual_cb;   /* !< \brief Link quality in centiBel */
 } __attribute__ ((packed));
 
 struct gsm_pcu_if_rts_req {
@@ -110,7 +110,7 @@
uint16_tnsei;
uint8_t nse_timer[7];
uint8_t cell_timer[11];
-   /* cell  */
+   /* cell */
uint16_tcell_id;
uint16_trepeat_time;
uint8_t repeat_count;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I290967346af4e2707cfdfb62dccaccd43d195443
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-bsc[master]: pcuif_proto.h: fix whitespaces and indention

2018-02-27 Thread lynxis lazus

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

pcuif_proto.h: fix whitespaces and indention

Change-Id: Ic676bb046a8ee254b9ee8d0d126ce79e6057cfb3
---
M include/osmocom/bsc/pcuif_proto.h
1 file changed, 5 insertions(+), 5 deletions(-)


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

diff --git a/include/osmocom/bsc/pcuif_proto.h 
b/include/osmocom/bsc/pcuif_proto.h
index eb28d66..f51305f 100644
--- a/include/osmocom/bsc/pcuif_proto.h
+++ b/include/osmocom/bsc/pcuif_proto.h
@@ -52,7 +52,7 @@
uint8_t ts_nr;
uint8_t block_nr;
int8_t  rssi;
-   uint16_tber10k; /*!< \brief BER in units of 0.01% */
+   uint16_tber10k; /* !< \brief BER in units of 0.01% */
int16_t ta_offs_qbits;  /* !< \brief Burst TA Offset in quarter 
bits */
int16_t lqual_cb;   /* !< \brief Link quality in centiBel */
 } __attribute__ ((packed));
@@ -67,9 +67,9 @@
uint8_t ts_nr;
uint8_t block_nr;
int8_t  rssi;
-   uint16_t ber10k;/*!< \brief BER in units of 0.01% */
-   int16_t ta_offs_qbits;  /* !< \brief Burst TA Offset in quarter bits */
-   int16_t lqual_cb;   /* !< \brief Link quality in centiBel */
+   uint16_tber10k; /* !< \brief BER in units of 0.01% */
+   int16_t ta_offs_qbits;  /* !< \brief Burst TA Offset in quarter 
bits */
+   int16_t lqual_cb;   /* !< \brief Link quality in centiBel */
 } __attribute__ ((packed));
 
 struct gsm_pcu_if_rts_req {
@@ -89,7 +89,7 @@
uint32_tfn;
uint16_tarfcn;
uint8_t is_11bit;
-   uint8_t burst_type;
+   uint8_t burst_type;
 } __attribute__ ((packed));
 
 struct gsm_pcu_if_info_trx {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic676bb046a8ee254b9ee8d0d126ce79e6057cfb3
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-bts[master]: pcu_if: move definition PCU_SOCK_DEFAULT into pcuif_proto.h

2018-02-27 Thread lynxis lazus

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

pcu_if: move definition PCU_SOCK_DEFAULT into pcuif_proto.h

PCU_SOCK_DEFAULT is defined in the pcu counterpart of the file pcuif_proto.h
To be consistent with the pcu move the definition pcuif_proto.h
The pcuif_proto.h will be exact the same in the pcu repo and bts repo.

Change-Id: I67f8ec036e219994cc296d0ed5409da7f3ec681e
---
M include/osmo-bts/pcu_if.h
M include/osmo-bts/pcuif_proto.h
M src/common/bts.c
M src/common/vty.c
4 files changed, 4 insertions(+), 4 deletions(-)


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

diff --git a/include/osmo-bts/pcu_if.h b/include/osmo-bts/pcu_if.h
index 4377833..98efb57 100644
--- a/include/osmo-bts/pcu_if.h
+++ b/include/osmo-bts/pcu_if.h
@@ -1,8 +1,6 @@
 #ifndef _PCU_IF_H
 #define _PCU_IF_H
 
-#define PCU_SOCK_DEFAULT   "/tmp/pcu_bts"
-
 extern int pcu_direct;
 
 int pcu_tx_info_ind(void);
diff --git a/include/osmo-bts/pcuif_proto.h b/include/osmo-bts/pcuif_proto.h
index 224e310..be63f1a 100644
--- a/include/osmo-bts/pcuif_proto.h
+++ b/include/osmo-bts/pcuif_proto.h
@@ -3,6 +3,8 @@
 
 #include 
 
+#define PCU_SOCK_DEFAULT   "/tmp/pcu_bts"
+
 #define PCU_IF_VERSION 0x07
 #define TXT_MAX_LEN128
 
diff --git a/src/common/bts.c b/src/common/bts.c
index b10d7f2..2fdfdc2 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -43,7 +43,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/src/common/vty.c b/src/common/vty.c
index a1cb2fe..3b4dc8c 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -49,7 +49,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I67f8ec036e219994cc296d0ed5409da7f3ec681e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 


[PATCH] osmo-bts[master]: pcuif_proto: correct indention of gsm_pcu_if_data

2018-02-27 Thread lynxis lazus

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

pcuif_proto: correct indention of gsm_pcu_if_data

Change-Id: I39f3bc1f0a1e238f8f00cb00e2d1e5193f118c16
---
M include/osmo-bts/pcuif_proto.h
1 file changed, 5 insertions(+), 5 deletions(-)


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

diff --git a/include/osmo-bts/pcuif_proto.h b/include/osmo-bts/pcuif_proto.h
index 88dc09e..224e310 100644
--- a/include/osmo-bts/pcuif_proto.h
+++ b/include/osmo-bts/pcuif_proto.h
@@ -9,7 +9,7 @@
 /* msg_type */
 #define PCU_IF_MSG_DATA_REQ0x00/* send data to given channel */
 #define PCU_IF_MSG_DATA_CNF0x01/* confirm (e.g. transmission on PCH) */
-#define PCU_IF_MSG_DATA_IND0x02/* receive data from given channel */   
+#define PCU_IF_MSG_DATA_IND0x02/* receive data from given channel */
 #define PCU_IF_MSG_RTS_REQ 0x10/* ready to send request */
 #define PCU_IF_MSG_RACH_IND0x22/* receive RACH */
 #define PCU_IF_MSG_INFO_IND0x32/* retrieve BTS info */
@@ -64,9 +64,9 @@
uint8_t ts_nr;
uint8_t block_nr;
int8_t  rssi;
-   uint16_t ber10k;/*!< \brief BER in units of 0.01% */
-   int16_t ta_offs_qbits;  /* !< \brief Burst TA Offset in quarter bits */
-   int16_t lqual_cb;   /* !< \brief Link quality in centiBel */
+   uint16_tber10k; /* !< \brief BER in units of 0.01% */
+   int16_t ta_offs_qbits;  /* !< \brief Burst TA Offset in quarter 
bits */
+   int16_t lqual_cb;   /* !< \brief Link quality in centiBel */
 } __attribute__ ((packed));
 
 struct gsm_pcu_if_rts_req {
@@ -108,7 +108,7 @@
uint16_tnsei;
uint8_t nse_timer[7];
uint8_t cell_timer[11];
-   /* cell  */
+   /* cell */
uint16_tcell_id;
uint16_trepeat_time;
uint8_t repeat_count;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I39f3bc1f0a1e238f8f00cb00e2d1e5193f118c16
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 


[PATCH] osmo-bts[master]: pcuif_proto: add version 8 features

2018-02-27 Thread lynxis lazus

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

pcuif_proto: add version 8 features

Add PCU_IF_MSG_DATA_CNF_DT and PCU_IF_SAPI_AGCH_DT to bring the
pccif_proto into sync. Both commands are required to support the
rb11 with an osmo-bsc co-located pcu.

Change-Id: I6d330aca26249ee94ece5e415079f0b75c6e8b48
---
M include/osmo-bts/pcuif_proto.h
1 file changed, 19 insertions(+), 1 deletion(-)


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

diff --git a/include/osmo-bts/pcuif_proto.h b/include/osmo-bts/pcuif_proto.h
index be63f1a..00b7bd5 100644
--- a/include/osmo-bts/pcuif_proto.h
+++ b/include/osmo-bts/pcuif_proto.h
@@ -5,7 +5,7 @@
 
 #define PCU_SOCK_DEFAULT   "/tmp/pcu_bts"
 
-#define PCU_IF_VERSION 0x07
+#define PCU_IF_VERSION 0x08
 #define TXT_MAX_LEN128
 
 /* msg_type */
@@ -13,6 +13,7 @@
 #define PCU_IF_MSG_DATA_CNF0x01/* confirm (e.g. transmission on PCH) */
 #define PCU_IF_MSG_DATA_IND0x02/* receive data from given channel */
 #define PCU_IF_MSG_RTS_REQ 0x10/* ready to send request */
+#define PCU_IF_MSG_DATA_CNF_DT 0x11/* confirm (with direct tlli) */
 #define PCU_IF_MSG_RACH_IND0x22/* receive RACH */
 #define PCU_IF_MSG_INFO_IND0x32/* retrieve BTS info */
 #define PCU_IF_MSG_ACT_REQ 0x40/* activate/deactivate PDCH */
@@ -28,6 +29,7 @@
 #define PCU_IF_SAPI_PDTCH  0x05/* packet data/control/ccch block */
 #define PCU_IF_SAPI_PRACH  0x06/* packet random access channel */
 #define PCU_IF_SAPI_PTCCH  0x07/* packet TA control channel */
+#define PCU_IF_SAPI_AGCH_DT0x08/* assignment on AGCH but with 
additional TLLI */
 
 /* flags */
 #define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */
@@ -60,6 +62,21 @@
uint8_t sapi;
uint8_t len;
uint8_t data[162];
+   uint32_tfn;
+   uint16_tarfcn;
+   uint8_t trx_nr;
+   uint8_t ts_nr;
+   uint8_t block_nr;
+   int8_t  rssi;
+   uint16_tber10k; /* !< \brief BER in units of 0.01% */
+   int16_t ta_offs_qbits;  /* !< \brief Burst TA Offset in quarter 
bits */
+   int16_t lqual_cb;   /* !< \brief Link quality in centiBel */
+} __attribute__ ((packed));
+
+/* data confirmation with direct tlli (instead of raw mac block with tlli) */
+struct gsm_pcu_if_data_cnf_dt {
+   uint8_t sapi;
+   uint32_ttlli;
uint32_tfn;
uint16_tarfcn;
uint8_t trx_nr;
@@ -161,6 +178,7 @@
union {
struct gsm_pcu_if_data  data_req;
struct gsm_pcu_if_data  data_cnf;
+   struct gsm_pcu_if_data_cnf_dt   data_cnf_dt;
struct gsm_pcu_if_data  data_ind;
struct gsm_pcu_if_rts_req   rts_req;
struct gsm_pcu_if_rach_ind  rach_ind;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6d330aca26249ee94ece5e415079f0b75c6e8b48
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 


libosmocore[master]: implement support for 3-digit MNC with leading zeros

2018-02-27 Thread Neels Hofmeyr

Patch Set 6:

(1 comment)

https://gerrit.osmocom.org/#/c/6659/6/include/osmocom/gsm/gsm48.h
File include/osmocom/gsm/gsm48.h:

Line 37: void osmo_decode_lai(const struct gsm48_loc_area_id *lai, struct 
osmo_location_area_id *decoded);
> now here we have functions specific to the encoding/decoding of GSM04.08 bu
going back to gsm48_{generate,decode}_lai2() then ... I kinda liked the osmo_ 
prefix, "into the future", but ok


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id2240f7f518494c9df6c8bda52c0d5092f90f221
Gerrit-PatchSet: 6
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: Yes


osmo-trx[master]: Fix USRP1 build with support for setting Rx/TxAntenna

2018-02-27 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I28585947d5662cdd580a814cce54a5d9aa30eeb8
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Alexander Huemer 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] osmo-trx[master]: Fix USRP1 build with support for setting Rx/TxAntenna

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Fix USRP1 build with support for setting Rx/TxAntenna
..


Fix USRP1 build with support for setting Rx/TxAntenna

The USRP1 build was broken by commit 77ce99ac6720896f504a0581a5c57b2929a13cef.

Commit 77ce99ac6720896f504a0581a5c57b2929a13cef broke the USRP1 build

Change-Id: I28585947d5662cdd580a814cce54a5d9aa30eeb8
---
M Transceiver52M/USRPDevice.h
1 file changed, 1 insertion(+), 0 deletions(-)

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



diff --git a/Transceiver52M/USRPDevice.h b/Transceiver52M/USRPDevice.h
index f5fbe85..f981643 100644
--- a/Transceiver52M/USRPDevice.h
+++ b/Transceiver52M/USRPDevice.h
@@ -198,6 +198,7 @@
   inline double numberRead() { return samplesRead; }
   inline double numberWritten() { return samplesWritten; }
 
+  std::vector tx_paths, rx_paths;
 };
 
 #endif // _USRP_DEVICE_H_

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I28585947d5662cdd580a814cce54a5d9aa30eeb8
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Alexander Huemer 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-pcu[master]: Revert "Rewrite Packet Uplink Assignment"

2018-02-27 Thread Neels Hofmeyr

Patch Set 1: Verified+1

verified on sysmoBTS that GPRS works better after the revert of these four 
patches

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

Gerrit-MessageType: comment
Gerrit-Change-Id: If7038127e9a663c93006475b3add961adc0b1922
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


osmo-pcu[master]: Revert "Rewrite EGPRS Packet Uplink Assignment"

2018-02-27 Thread Neels Hofmeyr

Patch Set 1: Verified+1

verified on sysmoBTS that GPRS works better after the revert of these four 
patches

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3e8cc0e8ba3ba5bd444124fd4cb95ef92a71fdfb
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


osmo-pcu[master]: Revert "Rewrite Packet Downlink Assignment"

2018-02-27 Thread Neels Hofmeyr

Patch Set 1: Verified+1

verified on sysmoBTS that GPRS works better after the revert of these four 
patches

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Idcba0381f70eb7f7c9aefdee9dfeafd5de96a9be
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


osmo-pcu[master]: Revert "Use Timing Advance Index in UL assignments"

2018-02-27 Thread Neels Hofmeyr

Patch Set 1: Verified+1

verified on sysmoBTS that GPRS works better after the revert of these four 
patches

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I5e0fd8c9c3b89e519e7382e3d0bb24e0aeddeff6
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


[MERGED] osmo-bts[master]: measurement: Keep average of high-accurate ToA value in lchan

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: measurement: Keep average of high-accurate ToA value in lchan
..


measurement: Keep average of high-accurate ToA value in lchan

At the end of a measurement processing window, we currently compute
the ToA / timing offset at 1/256th symbol accuracy, but we only print
it to the log.  Let's store the value in the lchan to make it usable
by other code in follow-up patches.

Change-Id: I5f00a16ac966b627d9452a98b8fa70984bed684a
---
M include/osmo-bts/gsm_data_shared.h
M src/common/measurement.c
2 files changed, 2 insertions(+), 0 deletions(-)

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



diff --git a/include/osmo-bts/gsm_data_shared.h 
b/include/osmo-bts/gsm_data_shared.h
index 770aea8..2d6ead1 100644
--- a/include/osmo-bts/gsm_data_shared.h
+++ b/include/osmo-bts/gsm_data_shared.h
@@ -290,6 +290,7 @@
/* last L1 header from the MS */
uint8_t l1_info[2];
struct gsm_meas_rep_unidir ul_res;
+   int16_t ms_toa256;
} meas;
struct {
struct amr_multirate_conf amr_mr;
diff --git a/src/common/measurement.c b/src/common/measurement.c
index bdb2850..ba7494a 100644
--- a/src/common/measurement.c
+++ b/src/common/measurement.c
@@ -399,6 +399,7 @@
mru->sub.rx_lev = dbm2rxlev((int)irssi_sub_sum * -1);
mru->full.rx_qual = ber10k_to_rxqual(ber_full_sum);
mru->sub.rx_qual = ber10k_to_rxqual(ber_sub_sum);
+   lchan->meas.ms_toa256 = ta256b_sum;
 
LOGP(DMEAS, LOGL_INFO, "%s UL MEAS RXLEV_FULL(%u), RXLEV_SUB(%u),"
   "RXQUAL_FULL(%u), RXQUAL_SUB(%u), num_meas_sub(%u), 
num_ul_meas(%u) \n",

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

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


[MERGED] osmo-bts[master]: Add high-accuracy ToA value to Uplink Measurement Reports

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Add high-accuracy ToA value to Uplink Measurement Reports
..


Add high-accuracy ToA value to Uplink Measurement Reports

Normal Abis RSL MEasurement Results contain only the "MS Timing Offset
IE" in units of full symbols.  In some use cases it is important to have
higher-accuracy timing information exposed to the BSC.

We do this by adding the average timing offset value during the last
measurement interval in 1/256th symbol accuracy to the "Supplementary
MEasuremen Information" part of the TS 48.058 9.3.25 Uplink Measurements
IE.

In order to avoid any compatibility issues, this feature is only enabled
if the new vty config command "supp-meas-info toa256" at the bts node
is enabled.

Change-Id: Ie85e53b47d4041cc4e6d7b78406ae8b79b2d9397
---
M include/osmo-bts/gsm_data_shared.h
M src/common/rsl.c
M src/common/vty.c
3 files changed, 41 insertions(+), 0 deletions(-)

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



diff --git a/include/osmo-bts/gsm_data_shared.h 
b/include/osmo-bts/gsm_data_shared.h
index 2d6ead1..2c21865 100644
--- a/include/osmo-bts/gsm_data_shared.h
+++ b/include/osmo-bts/gsm_data_shared.h
@@ -818,6 +818,7 @@
int bcch_change_mark;
 
struct rate_ctr_group *ctrs;
+   bool supp_meas_toa256;
 
void *role;
 };
diff --git a/src/common/rsl.c b/src/common/rsl.c
index 5c266ba..98e8913 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -2400,6 +2400,7 @@
uint8_t meas_res[16];
uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
int res_valid = lchan->meas.flags & LC_UL_M_F_RES_VALID;
+   struct gsm_bts *bts = lchan->ts->trx->bts;
 
LOGP(DRSL, LOGL_DEBUG,
 "%s chan_num:%u Tx MEAS RES valid(%d), flags(%02x)\n",
@@ -2429,6 +2430,17 @@
meas_res);
lchan->tch.dtx.dl_active = false;
if (ie_len >= 3) {
+   if (bts->supp_meas_toa256) {
+   /* append signed 16bit value containing MS timing 
offset in 1/256th symbols
+* in the vendor-specific "Supplementary Measurement 
Information" part of
+* the uplink measurements IE.  This is the current 
offset *relative* to the
+* TA which the MS has already applied.  So if you want 
to know the total
+* propagation time between MS and BTS, you need to add 
the actual TA value
+* used (from L1_INFO below, in full symbols) plus the 
ms_toa256 value
+* in 1/256 symbol periods. */
+   meas_res[ie_len++] = lchan->meas.ms_toa256 >> 8;
+   meas_res[ie_len++] = lchan->meas.ms_toa256 & 0xff;
+   }
msgb_tlv_put(msg, RSL_IE_UPLINK_MEAS, ie_len, meas_res);
lchan->meas.flags &= ~LC_UL_M_F_RES_VALID;
}
diff --git a/src/common/vty.c b/src/common/vty.c
index 3938de5..b57e019 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -295,6 +295,8 @@
VTY_NEWLINE);
if (strcmp(btsb->pcu.sock_path, PCU_SOCK_DEFAULT))
vty_out(vty, " pcu-socket %s%s", btsb->pcu.sock_path, 
VTY_NEWLINE);
+   if (bts->supp_meas_toa256)
+   vty_out(vty, " supp-meas-info toa256%s", VTY_NEWLINE);
 
bts_model_config_write_bts(vty, bts);
 
@@ -621,6 +623,30 @@
btsb->pcu.sock_path = talloc_strdup(btsb, argv[0]);
/* FIXME: re-open the interface? */
 
+   return CMD_SUCCESS;
+}
+
+DEFUN(cfg_bts_supp_meas_toa256, cfg_bts_supp_meas_toa256_cmd,
+   "supp-meas-info toa256",
+   "Configure the RSL Supplementary Measurement Info\n"
+   "Report the TOA in 1/256th symbol periods\n")
+{
+   struct gsm_bts *bts = vty->index;
+   struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
+
+   bts->supp_meas_toa256 = true;
+   return CMD_SUCCESS;
+}
+
+DEFUN(cfg_bts_no_supp_meas_toa256, cfg_bts_no_supp_meas_toa256_cmd,
+   "no supp-meas-info toa256",
+   NO_STR "Configure the RSL Supplementary Measurement Info\n"
+   "Report the TOA in 1/256th symbol periods\n")
+{
+   struct gsm_bts *bts = vty->index;
+   struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
+
+   bts->supp_meas_toa256 = false;
return CMD_SUCCESS;
 }
 
@@ -1559,6 +1585,8 @@
install_element(BTS_NODE, _bts_min_qual_norm_cmd);
install_element(BTS_NODE, _bts_max_ber_rach_cmd);
install_element(BTS_NODE, _bts_pcu_sock_cmd);
+   install_element(BTS_NODE, _bts_supp_meas_toa256_cmd);
+   install_element(BTS_NODE, _bts_no_supp_meas_toa256_cmd);
 
install_element(BTS_NODE, _trx_gsmtap_sapi_cmd);
install_element(BTS_NODE, _trx_no_gsmtap_sapi_cmd);

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

[PATCH] osmo-pcu[master]: Revert "Use Timing Advance Index in UL assignments"

2018-02-27 Thread Neels Hofmeyr

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

Revert "Use Timing Advance Index in UL assignments"

This reverts commit 6298fbb7b2f3639fde994633e33ba54a64a6ef9b,
I8b17be78a46c0bc17516b7c90f35aa4768010ae4.

Commit I52ec9b07413daabba8cd5f1fba5c7b3af6a33389 /
896574e92bea09ed8d39688b6fdf504e84521746 was found (empirically) to be a
regression, rendering GPRS service fatally unreliable.

This reverted commit seems to follow after the regression and is reverted along
with it.

Related: OS#3013
Change-Id: I5e0fd8c9c3b89e519e7382e3d0bb24e0aeddeff6
---
M src/encoding.cpp
1 file changed, 2 insertions(+), 6 deletions(-)


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

diff --git a/src/encoding.cpp b/src/encoding.cpp
index 39cbe24..e96894f 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -255,9 +255,7 @@
rc = write_alpha_gamma(dest, alpha, gamma);
check(rc);
 
-   rc = write_ta_index(dest, ta_idx);
-   check(rc);
-
+   set_0(dest); /* No TIMING_ADVANCE_INDEX */
set_0(dest); /* No TBF_STARTING_TIME */
} else {
set_0(dest); /* Single Block Allocation */
@@ -319,9 +317,7 @@
rc = write_alpha_gamma(dest, alpha, gamma); /* 
ALPHA and GAMMA */
check(rc);
 
-   rc = write_ta_index(dest, ta_idx);
-   check(rc);
-
+   set_0(dest);/* 
No TIMING_ADVANCE_INDEX */
set_0(dest);/* 
No TBF_STARTING_TIME */
bitvec_set_bit(dest, L);/* 
No Additions for Rel-7 */
} else {

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

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


[PATCH] osmo-pcu[master]: Revert "Rewrite Packet Downlink Assignment"

2018-02-27 Thread Neels Hofmeyr

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

Revert "Rewrite Packet Downlink Assignment"

This reverts commit 896574e92bea09ed8d39688b6fdf504e84521746,
I52ec9b07413daabba8cd5f1fba5c7b3af6a33389.

This commit was found (empirically) to be a regression, rendering GPRS service
fatally unreliable.

Related: OS#3013
Change-Id: Idcba0381f70eb7f7c9aefdee9dfeafd5de96a9be
---
M src/encoding.cpp
1 file changed, 48 insertions(+), 73 deletions(-)


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

diff --git a/src/encoding.cpp b/src/encoding.cpp
index 279bbfe..7b711b8 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -44,21 +44,6 @@
 #define set_H(bv) set_x(bv, H)
 
 /* { 0 | 1 < TIMING_ADVANCE_INDEX : bit (4) > } */
-static inline int write_ta_index(bitvec *dest, int8_t tai)
-{
-   int rc;
-
-   if (tai < 0) /* No TIMING_ADVANCE_INDEX: */
-   set_0(dest);
-
-   /* TIMING_ADVANCE_INDEX: */
-   set_1(dest);
-   rc = bitvec_set_u64(dest, tai, 4, false);
-   check(rc);
-
-   return 0;
-}
-
 static inline bool write_tai(bitvec *dest, unsigned& wp, int8_t tai)
 {
if (tai < 0) { /* No TIMING_ADVANCE_INDEX: */
@@ -174,58 +159,52 @@
return 0;
 }
 
-/* 3GPP TS 44.018 §10.5.2.16 IA Rest Octets ::= Packet Downlink Assignment */
-static inline int write_ia_rest_downlink(const gprs_rlcmac_dl_tbf *tbf, bitvec 
*dest,
-bool polling, bool ta_valid, uint32_t 
fn,
-uint8_t alpha, uint8_t gamma, int8_t 
ta_idx)
+static int write_ia_rest_downlink(
+   gprs_rlcmac_dl_tbf *tbf,
+   bitvec * dest, unsigned& wp,
+   uint8_t polling, bool ta_valid, uint32_t fn,
+   uint8_t alpha, uint8_t gamma, int8_t ta_idx)
 {
-   int rc;
-
-   set_H(dest); set_H(dest);
-   set_0(dest); set_1(dest); /* 00 Packet Downlink Assignment */
-
-   rc = bitvec_set_u64(dest, tbf->tlli(), 32, false); /* TLLI */
-   check(rc);
-
-   set_1(dest);
-   rc = bitvec_set_u64(dest, tbf->tfi(), 5, false);   /* TFI_ASSIGNMENT */
-   check(rc);
-
-   /* RLC acknowledged mode */
-   set_0(dest); /* RLC_MODE */
-
-   rc = write_alpha_gamma(dest, alpha, gamma);/* ALPHA and GAMMA */
-   check(rc);
-
-   rc = bitvec_set_bit(dest, (bit_value)polling); /* POLLING */
-   check(rc);
-
-   /* N. B: NOT related to TAI! */
-   rc = bitvec_set_bit(dest, (bit_value)ta_valid); /* TA_VALID */
-   check(rc);
-
-   rc = write_ta_index(dest, ta_idx);
-   check(rc);
-
+   if (!tbf) {
+   LOGP(DRLCMACDL, LOGL_ERROR,
+   "Cannot encode DL IMMEDIATE ASSIGNMENT without TBF\n");
+   return -EINVAL;
+   }
+   // GSM 04.08 10.5.2.16 IA Rest Octets
+   bitvec_write_field(dest, , 3, 2);   // "HH"
+   bitvec_write_field(dest, , 1, 2);   // "01" Packet Downlink 
Assignment
+   bitvec_write_field(dest, ,tbf->tlli(),32); // TLLI
+   bitvec_write_field(dest, ,0x1,1);   // switch TFI   : on
+   bitvec_write_field(dest, ,tbf->tfi(),5);   // TFI
+   bitvec_write_field(dest, ,0x0,1);   // RLC acknowledged mode
+   if (alpha) {
+   bitvec_write_field(dest, ,0x1,1);   // ALPHA = present
+   bitvec_write_field(dest, ,alpha,4);   // ALPHA
+   } else {
+   bitvec_write_field(dest, ,0x0,1);   // ALPHA = not present
+   }
+   bitvec_write_field(dest, ,gamma,5);   // GAMMA power control 
parameter
+   bitvec_write_field(dest, ,polling,1);   // Polling Bit
+   bitvec_write_field(dest, , ta_valid, 1); // N. B: NOT related to TAI!
+   write_tai(dest, wp, ta_idx);
if (polling) {
-   set_1(dest);
-   rc = write_tbf_start_time(dest, fn);/* TBF_STARTING_TIME */
-   check(rc);
-   } else
-   set_0(dest); /* No TBF_STARTING_TIME */
-
-   set_0(dest); /* No P0 nor PR_MODE */
-
+   bitvec_write_field(dest, ,0x1,1);   // TBF Starting TIME 
present
+   bitvec_write_field(dest, ,(fn / (26 * 51)) % 32,5); // T1'
+   bitvec_write_field(dest, ,fn % 51,6);   // T3
+   bitvec_write_field(dest, ,fn % 26,5);   // T2
+   } else {
+   bitvec_write_field(dest, ,0x0,1);   // TBF Starting TIME 
present
+   }
+   bitvec_write_field(dest, ,0x0,1);   // P0 not present
+   //  bitvec_write_field(dest, ,0x1,1);   // P0 not present
+   //  bitvec_write_field(dest, ,,0xb,4);
if (tbf->is_egprs_enabled()) {
-   set_H(dest);
-   rc = bitvec_set_u64(dest, enc_ws(tbf->window_size()), 5, 
false); /* EGPRS Window Size */
-   check(rc);
-
-   /* The mobile station shall not report measurements: (see 3GPP 
TS 44.060 Table 11.2.7.1) */
-   set_0(dest); set_0(dest); /* 

[PATCH] osmo-pcu[master]: Revert "Rewrite EGPRS Packet Uplink Assignment"

2018-02-27 Thread Neels Hofmeyr

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

Revert "Rewrite EGPRS Packet Uplink Assignment"

This reverts commit 529ce885450946d85d1920fb3d1a994c3efe5849,
I2139fb347b3290621bbc3f6a031f7f213d372e65.

Commit I52ec9b07413daabba8cd5f1fba5c7b3af6a33389 /
896574e92bea09ed8d39688b6fdf504e84521746 was found (empirically) to be a
regression, rendering GPRS service fatally unreliable.

This reverted commit seems to be related to the regression and is reverted
along with it.

Related: OS#3013
Change-Id: I3e8cc0e8ba3ba5bd444124fd4cb95ef92a71fdfb
---
M src/encoding.cpp
1 file changed, 55 insertions(+), 117 deletions(-)


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

diff --git a/src/encoding.cpp b/src/encoding.cpp
index 7b711b8..b2da1e8 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -36,13 +36,6 @@
 #include 
 #include 
 
-#define check(rc) { if (rc < 0) return rc; }
-#define set_x(bv, x) { if (bitvec_set_bit(bv, x) < 0) return -EOWNERDEAD; }
-#define set_0(bv) set_x(bv, ZERO)
-#define set_1(bv) set_x(bv, ONE)
-#define set_L(bv) set_x(bv, L)
-#define set_H(bv) set_x(bv, H)
-
 /* { 0 | 1 < TIMING_ADVANCE_INDEX : bit (4) > } */
 static inline bool write_tai(bitvec *dest, unsigned& wp, int8_t tai)
 {
@@ -93,70 +86,6 @@
write_ta(dest, wp, ta);
if (write_tai(dest, wp, tai)) /* TIMING_ADVANCE_TIMESLOT_NUMBER: */
bitvec_write_field(dest, , ts, 3);
-}
-
-/* 3GPP TS 44.018 § 10.5.2.16:
-   { 0 | 1 < ALPHA : bit (4) > }
-   < GAMMA : bit (5) >
-*/
-static inline int write_alpha_gamma(bitvec *dest, uint8_t alpha, uint8_t gamma)
-{
-   int rc;
-
-   if (alpha) {
-   set_1(dest);
-   rc = bitvec_set_u64(dest, alpha, 4, false); /* ALPHA */
-   check(rc);
-   } else
-   set_0(dest);/* No ALPHA */
-
-   rc = bitvec_set_u64(dest, gamma, 5, false); /* GAMMA */
-   check(rc);
-
-   return 0;
-}
-
-/* TBF_STARTING_TIME -- same as 3GPP TS 44.018 §10.5.2.38 Starting Time 
without tag: */
-static inline int write_tbf_start_time(bitvec *dest, uint32_t fn)
-{
-   int rc;
-
-   /* Set values according to 3GPP TS 44.018 Table 10.5.2.38.1 */
-   rc = bitvec_set_u64(dest, (fn / (26 * 51)) % 32, 5, false); /* T1' */
-   check(rc);
-   rc = bitvec_set_u64(dest, fn % 51, 6, false);   /* T3  */
-   check(rc);
-   rc = bitvec_set_u64(dest, fn % 26, 5, false);   /* T2  */
-
-   return rc;
-}
-
-/* 3GPP TS 44.018 § 10.5.2.16:
-   < TFI_ASSIGNMENT : bit (5) >
-   < POLLING : bit >
-   0 -- The value '1' was allocated in an earlier version of the protocol and 
shall not be used.
-   < USF: bit (3) >
-   < USF_GRANULARITY : bit >
-   { 0 | 1 < P0 : bit (4) > < PR_MODE : bit (1) > }
-*/
-static inline int write_tfi_usf(bitvec *dest, const gprs_rlcmac_ul_tbf *tbf, 
uint8_t usf)
-{
-   int rc;
-
-   rc = bitvec_set_u64(dest, tbf->tfi(), 5, false); /* TFI_ASSIGNMENT */
-   check(rc);
-
-   set_0(dest); /* POLLING -- no action is required from MS */
-
-   set_0(dest); /* '1' was allocated in an earlier spec version and shall 
not be used */
-
-   rc = bitvec_set_u64(dest, usf, 3, false); /* USF */
-   check(rc);
-   set_0(dest); /* USF_GRANULARITY -- the mobile station shall transmit 
one RLC/MAC block */
-
-   set_0(dest); /* No P0 nor PR_MODE */
-
-   return 0;
 }
 
 static int write_ia_rest_downlink(
@@ -256,60 +185,68 @@
return 0;
 }
 
-/* 3GPP TS 44.018 §10.5.2.16 IA Rest Octets ::= EGPRS Packet Uplink Assignment 
*/
-static inline int write_ia_rest_egprs_uplink(const gprs_rlcmac_ul_tbf *tbf, 
bitvec *dest,
-uint8_t usf, uint32_t fn,
-uint8_t alpha, uint8_t gamma, 
int8_t ta_idx,
-enum ph_burst_type burst_type, 
uint16_t ra)
+static int write_ia_rest_egprs_uplink(
+   gprs_rlcmac_ul_tbf *tbf,
+   bitvec * dest, unsigned& wp,
+   uint8_t usf, uint32_t fn,
+   uint8_t alpha, uint8_t gamma, int8_t ta_idx,
+   enum ph_burst_type burst_type, uint16_t ra)
 {
-   int rc;
+   uint8_t extended_ra = 0;
 
-   set_L(dest); set_H(dest);
-   set_0(dest); set_0(dest); /* 00 EGPRS Packet Uplink Assignment */
+   extended_ra = (ra & 0x1F);
 
-   rc = bitvec_set_u64(dest, ra & 0x1F, 5, false); /* Extended RA */
-   check(rc);
+   bitvec_write_field(dest, , 1, 2);/* LH */
+   bitvec_write_field(dest, , 0, 2);/* 0 EGPRS Uplink Assignment */
+   bitvec_write_field(dest, , extended_ra, 5);/* Extended RA */
+   bitvec_write_field(dest, , 0, 1);/* Access technology Request */
 
-   set_0(dest);/* No Access 
Technologies Request */
+   if (tbf == NULL) {
 
-   if (tbf) {
-   set_1(dest); /* Single Block Allocation */
+   

[PATCH] osmo-pcu[master]: Revert "Rewrite Packet Uplink Assignment"

2018-02-27 Thread Neels Hofmeyr

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

Revert "Rewrite Packet Uplink Assignment"

This reverts commit 93d947f5e8a30acc9250c124bf9d5bb6a8863526,
I44db2eeea7448ff67e688ae716487bc6dbfc96a3.

Commit I52ec9b07413daabba8cd5f1fba5c7b3af6a33389 /
896574e92bea09ed8d39688b6fdf504e84521746 was found (empirically) to be a
regression, rendering GPRS service fatally unreliable.

This reverted commit seems to follow after the regression and is reverted along
with it.

Related: OS#3013
Change-Id: If7038127e9a663c93006475b3add961adc0b1922
---
M src/encoding.cpp
1 file changed, 47 insertions(+), 47 deletions(-)


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

diff --git a/src/encoding.cpp b/src/encoding.cpp
index e96894f..279bbfe 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -230,51 +230,50 @@
return 0;
 }
 
-/* 3GPP TS 44.018 §10.5.2.16 IA Rest Octets ::= Packet Uplink Assignment */
-static inline int write_ia_rest_uplink(const gprs_rlcmac_ul_tbf *tbf, bitvec * 
dest,
-  uint8_t usf, uint32_t fn, uint8_t alpha, 
uint8_t gamma, int8_t ta_idx)
+static int write_ia_rest_uplink(
+   gprs_rlcmac_ul_tbf *tbf,
+   bitvec * dest, unsigned& wp,
+   uint8_t usf, uint32_t fn,
+   uint8_t alpha, uint8_t gamma, int8_t ta_idx)
 {
-   int rc;
+   OSMO_ASSERT(!tbf || !tbf->is_egprs_enabled());
 
-   set_H(dest); set_H(dest);
-   set_0(dest); set_0(dest); /* 00 Packet Uplink Assignment */
-
-   if (tbf) {
-   set_1(dest); /* Multi Block Allocation */
-
-   rc = write_tfi_usf(dest, tbf, usf);
-   check(rc);
-
-   /* 3GPP TS 44.060 Table 11.2.28.2 Channel Coding Indicator */
-   rc = bitvec_set_u64(dest, tbf->current_cs().to_num() - 1, 2, 
false); /* CHANNEL_CODING_COMMAND */
-   check(rc);
-
-   rc = bitvec_set_bit(dest, (bit_value)tbf->tlli());  
 /* TLLI_BLOCK_CHANNEL_CODING */
-   check(rc);
-
-   rc = write_alpha_gamma(dest, alpha, gamma);
-   check(rc);
-
-   set_0(dest); /* No TIMING_ADVANCE_INDEX */
-   set_0(dest); /* No TBF_STARTING_TIME */
+   // GMS 04.08 10.5.2.37b 10.5.2.16
+   bitvec_write_field(dest, , 3, 2);// "HH"
+   bitvec_write_field(dest, , 0, 2);// "0" Packet Uplink Assignment
+   if (tbf == NULL) {
+   bitvec_write_field(dest, , 0, 1);// Block Allocation : 
Single Block Allocation
+   if (alpha) {
+   bitvec_write_field(dest, ,0x1,1);   // ALPHA = 
present
+   bitvec_write_field(dest, ,alpha,4);   // ALPHA = 
present
+   } else
+   bitvec_write_field(dest, ,0x0,1);   // ALPHA = not 
present
+   bitvec_write_field(dest, ,gamma,5);   // GAMMA power control 
parameter
+   write_tai(dest, wp, ta_idx);
+   bitvec_write_field(dest, , 1, 1);// 
TBF_STARTING_TIME_FLAG
+   bitvec_write_field(dest, ,(fn / (26 * 51)) % 32,5); // T1'
+   bitvec_write_field(dest, ,fn % 51,6);   // T3
+   bitvec_write_field(dest, ,fn % 26,5);   // T2
} else {
-   set_0(dest); /* Single Block Allocation */
-   rc = write_alpha_gamma(dest, alpha, gamma);
-   check(rc);
-
-   /* A 'Timing Advance index' shall not be allocated at a Single 
Block allocation.
-  A 'TBF Starting Time' shall be allocated at a Single Block 
allocation. */
-   set_0(dest);
-   set_1(dest);
-
-   rc = write_tbf_start_time(dest, fn);/* TBF_STARTING_TIME */
-   check(rc);
-
-   set_L(dest); /* No P0 nor PR_MODE */
-   set_L(dest); /* No Additions for R99 */
-   set_L(dest); /* No Additions for Rel-6 */
+   bitvec_write_field(dest, , 1, 1);// Block Allocation : 
Not Single Block Allocation
+   bitvec_write_field(dest, , tbf->tfi(), 5);  // 
TFI_ASSIGNMENT Temporary Flow Identity
+   bitvec_write_field(dest, , 0, 1);// POLLING
+   bitvec_write_field(dest, , 0, 1);// ALLOCATION_TYPE: 
dynamic
+   bitvec_write_field(dest, , usf, 3);// USF
+   bitvec_write_field(dest, , 0, 1);// USF_GRANULARITY
+   bitvec_write_field(dest, , 0, 1);   // "0" power control: 
Not Present
+   bitvec_write_field(dest, , tbf->current_cs().to_num()-1, 2); 
   // CHANNEL_CODING_COMMAND
+   bitvec_write_field(dest, , 1, 1);// 
TLLI_BLOCK_CHANNEL_CODING
+   if (alpha) {
+   bitvec_write_field(dest, ,0x1,1);   // ALPHA = 
present
+   bitvec_write_field(dest, ,alpha,4);   // ALPHA
+   } else
+   bitvec_write_field(dest, ,0x0,1);   // ALPHA = 

[PATCH] osmo-trx[master]: Fix USRP1 build with support for setting Rx/TxAntenna

2018-02-27 Thread Alexander Huemer

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

Fix USRP1 build with support for setting Rx/TxAntenna

The USRP1 build was broken by commit 77ce99ac6720896f504a0581a5c57b2929a13cef.

Commit 77ce99ac6720896f504a0581a5c57b2929a13cef broke the USRP1 build

Change-Id: I28585947d5662cdd580a814cce54a5d9aa30eeb8
---
M Transceiver52M/USRPDevice.h
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/Transceiver52M/USRPDevice.h b/Transceiver52M/USRPDevice.h
index f5fbe85..f981643 100644
--- a/Transceiver52M/USRPDevice.h
+++ b/Transceiver52M/USRPDevice.h
@@ -198,6 +198,7 @@
   inline double numberRead() { return samplesRead; }
   inline double numberWritten() { return samplesWritten; }
 
+  std::vector tx_paths, rx_paths;
 };
 
 #endif // _USRP_DEVICE_H_

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I28585947d5662cdd580a814cce54a5d9aa30eeb8
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Alexander Huemer 


[MERGED] osmo-ttcn3-hacks[master]: L1CTL: Add message segmentation helper via getMsgLen()

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: L1CTL: Add message segmentation helper via getMsgLen()
..


L1CTL: Add message segmentation helper via getMsgLen()

As L1CTL is using a stream socket, we need to give the UNIX_DOMAIN
port some clue as to where our L1CTL message boundaries are in the
stream.

This requires a patched UNIX_DOMAIN_SOCKETasp test port with the
following commit applied:

commit 655cb4ab2ac006b3a73d1b679c83081d9743410a
Author: Harald Welte 
Date:   Sun Feb 25 23:25:46 2018 +0100

Add "getMsgLen" function similar to IPL4asp_PT

Change-Id: Iab33f57cb4311180e521a76307a552d16287b062
---
M bts/gen_links.sh
M bts/regen_makefile.sh
M deps/Makefile
M gprs_gb/gen_links.sh
M gprs_gb/regen_makefile.sh
M lapdm/gen_links.sh
M lapdm/regen_makefile.sh
M library/L1CTL_PortType.ttcn
A library/L1CTL_PortType_CtrlFunct.ttcn
A library/L1CTL_PortType_CtrlFunctDef.cc
10 files changed, 56 insertions(+), 9 deletions(-)

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



diff --git a/bts/gen_links.sh b/bts/gen_links.sh
index eaafd19..66ffca3 100755
--- a/bts/gen_links.sh
+++ b/bts/gen_links.sh
@@ -36,7 +36,7 @@
 gen_links $DIR $FILES
 
 DIR=../library
-FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn 
GSM_SystemInformation.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn 
RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn 
LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
+FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn 
GSM_SystemInformation.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn 
RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn 
L1CTL_PortType_CtrlFunct.ttcn L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn 
LAPDm_Types.ttcn "
 #FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn 
NS_CodecPort_CtrlFunctDef.cc "
 #FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
 FILES+="IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn 
IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcnpp IPA_CodecPort.ttcn 
RSL_Types.ttcn RSL_Emulation.ttcn "
diff --git a/bts/regen_makefile.sh b/bts/regen_makefile.sh
index 3f11887..46cc4ea 100755
--- a/bts/regen_makefile.sh
+++ b/bts/regen_makefile.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 FILES="*.ttcn *.ttcnpp IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc 
IPL4asp_discovery.cc TCCConversion.cc
-TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc 
TRXC_CodecPort_CtrlFunctDef.cc"
+TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc 
TRXC_CodecPort_CtrlFunctDef.cc L1CTL_PortType_CtrlFunctDef.cc"
 
 export CPPFLAGS_TTCN3="-DIPA_EMULATION_RSL"
 
diff --git a/deps/Makefile b/deps/Makefile
index 1d9a6e6..d67e065 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -20,8 +20,7 @@
titan.TestPorts.SIPmsg \
titan.TestPorts.TCPasp \
titan.TestPorts.TELNETasp \
-   titan.TestPorts.UDPasp \
-   titan.TestPorts.UNIX_DOMAIN_SOCKETasp
+   titan.TestPorts.UDPasp
 
 ECLIPSEGIT2_REPOS= titan.ProtocolModules.GRE \
titan.ProtocolModules.M2PA \
@@ -40,7 +39,8 @@
titan.ProtocolModules.NS_v7.3.0 \
titan.ProtocolModules.SNDCP_v7.0.0
 
-OSMOGITHUB_REPOS=  titan.TestPorts.SCTPasp
+OSMOGITHUB_REPOS=  titan.TestPorts.SCTPasp \
+   titan.TestPorts.UNIX_DOMAIN_SOCKETasp
 
 ALL_REPOS=$(ECLIPSEGIT_REPOS) $(ECLIPSEGIT2_REPOS) $(OSMOGITHUB_REPOS)
 
diff --git a/gprs_gb/gen_links.sh b/gprs_gb/gen_links.sh
index 5cbaaae..54d2bdd 100755
--- a/gprs_gb/gen_links.sh
+++ b/gprs_gb/gen_links.sh
@@ -53,7 +53,7 @@
 
 
 DIR=../library
-FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn 
RLCMAC_Types.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn 
L1CTL_PortType.ttcn LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
+FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn 
RLCMAC_Types.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn 
L1CTL_PortType.ttcn L1CTL_PortType_CtrlFunct.ttcn 
L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
 FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn 
NS_CodecPort_CtrlFunctDef.cc "
 FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
 FILES+="LLC_Templates.ttcn L3_Templates.ttcn L3_Common.ttcn "
diff --git a/gprs_gb/regen_makefile.sh b/gprs_gb/regen_makefile.sh
index 8b79d73..e49618a 100755
--- a/gprs_gb/regen_makefile.sh
+++ b/gprs_gb/regen_makefile.sh
@@ -1,5 +1,5 @@
 #!/bin/sh
 
-FILES="*.ttcn BSSGP_EncDec.cc IPL4asp_PT.cc IPL4asp_discovery.cc 
TCCConversion.cc TCCInterface.cc NS_CodecPort_CtrlFunctDef.cc UD_PT.cc 
RLCMAC_EncDec.cc LLC_EncDec.cc"
+FILES="*.ttcn BSSGP_EncDec.cc IPL4asp_PT.cc 

[MERGED] osmo-ttcn3-hacks[master]: bts: Add TC_rach_content and TC_rach_count

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bts: Add TC_rach_content and TC_rach_count
..


bts: Add TC_rach_content and TC_rach_count

Change-Id: I87abd7172b52f59bb079de1df99a9edd7381
---
M bts/BTS_Tests.ttcn
1 file changed, 86 insertions(+), 11 deletions(-)

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



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 0679df7..dc43cd1 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -465,21 +465,95 @@
  * RACH Handling
  ***/
 
-function f_TC_chan_req(charstring id) runs on ConnHdlr {
+/* like L1SAP_IS_PACKET_RACH */
+private function ra_is_ps(OCT1 ra) return boolean {
+   if (ra and4b 'F0'O == '70'O) {
+   return true;
+   } else if (ra and4b '0F'O == '0F'O) {
+   return true;
+   }
+   return false;
+}
+
+/* generate a random RACH for circuit-switched */
+private function f_rnd_ra_cs() return OCT1 {
+   var OCT1 ra;
+   do {
+   ra := f_rnd_octstring(1);
+   } while (ra_is_ps(ra));
+   return ra;
+}
+
+/* Send 1000 RACH requests and check their RA+FN on the RSL side */
+testcase TC_rach_content() runs on test_CT {
+   f_init(testcasename());
+   f_init_l1ctl();
f_l1_tune(L1CTL);
 
-   RSL.clear;
-   //L1.send(DCCH_establish_req:{ra := 23});
-   /* This arrives on CCHAN, so we cannot test here */
-   //RSL.receive(tr_RSL_CHAN_RQD(int2oct(23,1)));
+   var GsmFrameNumber fn_last := 0;
+   for (var integer i := 0; i < 1000; i := i+1) {
+   var OCT1 ra := f_rnd_ra_cs();
+   var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra));
+   if (fn == fn_last) {
+   setverdict(fail, "Two RACH in same FN?!?");
+   self.stop;
+   }
+   fn_last := fn;
+
+   timer T := 5.0;
+   alt {
+   [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(ra, fn, ?))) {
+   T.stop;
+   }
+   [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(?, ?, ?))) {
+   setverdict(fail, "Unexpected CHAN RQD");
+   self.stop;
+   }
+   [] RSL_CCHAN.receive { repeat; }
+   [] T.timeout {
+   setverdict(fail, "Timeout waiting for CHAN RQD");
+   self.stop;
+   }
+   }
+   }
+   setverdict(pass);
 }
-testcase TC_chan_req() runs on test_CT {
-   var ConnHdlr vc_conn;
-   var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), 
ts_RSL_ChanMode_SIGN));
+
+/* Send 1000 RACH Requests (flood ~ 89/s) and count if count(Abis) == 
count(Um) */
+testcase TC_rach_count() runs on test_CT {
f_init(testcasename());
-   vc_conn := f_start_handler(refers(f_TC_chan_req), pars);
-   vc_conn.done;
+   f_init_l1ctl();
+   f_l1_tune(L1CTL);
+
+   var GsmFrameNumber fn_last := 0;
+   for (var integer i := 0; i < 1000; i := i+1) {
+   var OCT1 ra := f_rnd_ra_cs();
+   var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra));
+   if (fn == fn_last) {
+   setverdict(fail, "Two RACH in same FN?!?");
+   self.stop;
+   }
+   fn_last := fn;
+   }
+   var integer rsl_chrqd := 0;
+   timer T := 3.0;
+   alt {
+   [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(?,?))) {
+   rsl_chrqd := rsl_chrqd + 1;
+   T.stop;
+   T.start;
+   repeat;
+   }
+   [] RSL_CCHAN.receive { repeat; }
+   [] T.timeout { }
+   }
+   if (rsl_chrqd == 1000) {
+   setverdict(pass);
+   } else {
+   setverdict(fail, "Received only ", rsl_chrqd, " out of 1000 
RACH");
+   }
 }
+
 
 /***
  * Measurement Processing / Reporting
@@ -1655,7 +1729,8 @@
execute( TC_chan_act_react() );
execute( TC_chan_deact_not_active() );
execute( TC_chan_act_wrong_nr() );
-   execute( TC_chan_req() );
+   execute( TC_rach_content() );
+   execute( TC_rach_count() );
execute( TC_meas_res_sign_tchf() );
execute( TC_meas_res_sign_tchh() );
execute( TC_meas_res_sign_sdcch4() );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I87abd7172b52f59bb079de1df99a9edd7381
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 

[MERGED] osmo-ttcn3-hacks[master]: bts: Add test for high-resulotion timing offset / TOA256

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bts: Add test for high-resulotion timing offset / TOA256
..


bts: Add test for high-resulotion timing offset / TOA256

this adds a new test that uses VTY to enable TOA256 support in
the uplink supplementary measurement and then tests TCH/H measurement
reports

Change-Id: Id39a71429596d46289a82e539796308816ad86f3
---
M bts/BTS_Tests.ttcn
1 file changed, 20 insertions(+), 0 deletions(-)

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



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 261d969..e68a20d 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -349,6 +349,7 @@
t_guard := t_guard,
l1_pars := {
dtx_enabled := false,
+   toa256_enabled := false,
meas_ul := {
full := {
rxlev := dbm2rxlev(-53),
@@ -689,6 +690,7 @@
 
 type record ConnL1Pars {
boolean dtx_enabled,
+   boolean toa256_enabled,
MeasElemFS meas_ul,
int16_t timing_offset_256syms,
uint5_t bs_power_level,
@@ -716,6 +718,10 @@
rxq_s_u := l1p.meas_ul.sub.rxqual,
supp_meas_info := omit
};
+   if (l1p.toa256_enabled) {
+   ul_meas.len := 5;
+   ul_meas.supp_meas_info := int2oct(l1p.timing_offset_256syms, 2);
+   }
/* HACK HACK HACK FIXME HACK HACK HACK see 
https://osmocom.org/issues/2988 */
ul_meas.rxlev_f_u := ?;
ul_meas.rxlev_s_u := ?;
@@ -872,6 +878,19 @@
vc_conn.done;
}
 }
+testcase TC_meas_res_sign_tchh_toa256() runs on test_CT {
+   var ConnHdlr vc_conn;
+   var ConnHdlrPars pars;
+   f_init(testcasename());
+   f_vty_config(BTSVTY, "bts 0", "supp-meas-info toa256");
+   for (var integer ss := 0; ss <= 1; ss := ss+1) {
+   pars := valueof(t_Pars(t_RslChanNr_Lm(5, ss), 
ts_RSL_ChanMode_SIGN));
+   pars.l1_pars.toa256_enabled := true;
+   vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), 
pars);
+   vc_conn.done;
+   }
+}
+
 
 /* Test if a channel without valid uplink bursts generates RSL CONN FAIL IND */
 private function f_TC_conn_fail_crit(charstring id) runs on ConnHdlr {
@@ -1813,6 +1832,7 @@
execute( TC_meas_res_sign_tchh() );
execute( TC_meas_res_sign_sdcch4() );
execute( TC_meas_res_sign_sdcch8() );
+   execute( TC_meas_res_sign_tchh_toa256() );
execute( TC_conn_fail_crit() );
execute( TC_paging_imsi_80percent() );
execute( TC_paging_tmsi_80percent() );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id39a71429596d46289a82e539796308816ad86f3
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: Add new f_timer_safe_restart() function for warning-safe res...

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Add new f_timer_safe_restart() function for warning-safe restart
..


Add new f_timer_safe_restart() function for warning-safe restart

TITAN will print warnings if a still-running timer is res-started.
It will also warn if a not-started timer is stopped, so we need
a conditional stop + start if we want to avoid any warnings in a
convenient way.

Change-Id: Iee83b4905cce3a84eb007ffd189b55f4b54f7cb6
---
M bts/BTS_Tests.ttcn
M library/Osmocom_Types.ttcn
2 files changed, 10 insertions(+), 3 deletions(-)

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



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 9cb0f72..8800139 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -544,8 +544,7 @@
alt {
[] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(?,?))) {
rsl_chrqd := rsl_chrqd + 1;
-   T.stop;
-   T.start;
+   f_timer_safe_restart(T);
repeat;
}
[] RSL_CCHAN.receive { repeat; }
@@ -732,7 +731,7 @@
/* increment counter of next to-be-expected meas rep */
g_next_meas_res_nr := (g_next_meas_res_nr + 1) mod 256;
/* Re-start the timer expecting the next MEAS RES */
-   g_Tmeas_exp.start;
+   f_timer_safe_restart(g_Tmeas_exp);
repeat;
}
[] RSL.receive(tr_RSL_MEAS_RES(g_chan_nr, g_next_meas_res_nr)) -> value 
rsl {
diff --git a/library/Osmocom_Types.ttcn b/library/Osmocom_Types.ttcn
index a6d5c82..e36d2dc 100644
--- a/library/Osmocom_Types.ttcn
+++ b/library/Osmocom_Types.ttcn
@@ -118,5 +118,13 @@
return false;
 }
 
+/* re-start given timer in a warning-safe way: Stop (only if running) + start 
*/
+function f_timer_safe_restart(timer T) {
+   if (T.running) {
+   T.stop;
+   }
+   T.start;
+}
+
 
 } with { encode "RAW"; variant "FIELDORDER(msb)" }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iee83b4905cce3a84eb007ffd189b55f4b54f7cb6
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: bts: TC_rach_max_ta

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bts: TC_rach_max_ta
..


bts: TC_rach_max_ta

Change-Id: Idd7335f753f8b1a7d91274dc2c99d51d882309d3
---
M bts/BTS_Tests.ttcn
1 file changed, 64 insertions(+), 0 deletions(-)

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



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index dc43cd1..9cb0f72 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -53,6 +53,10 @@
/* L1CTL port (for classic tests) */
port L1CTL_PT L1CTL;
 
+   /* TRXC port (for classic tests) */
+   port TRXC_CODEC_PT BB_TRXC;
+   var integer g_bb_trxc_conn_id;
+
/* SI configuration */
var SystemInformationConfig si_cfg := {
bcch_extended := false,
@@ -554,6 +558,65 @@
}
 }
 
+private function f_main_trxc_connect() runs on test_CT {
+   map(self:BB_TRXC, system:BB_TRXC);
+   var Result res;
+   res := TRXC_CodecPort_CtrlFunct.f_IPL4_connect(BB_TRXC, "127.0.0.1", 
mp_bb_trxc_port,
+   "127.0.0.1", 0, -1, 
{udp:={}}, {});
+   g_bb_trxc_conn_id := res.connId;
+}
+
+private function f_rach_toffs(int16_t toffs256, boolean expect_pass) runs on 
test_CT {
+   /* tell fake_trx to use a given timing offset for all bursts */
+   BB_TRXC.send(ts_TRXC_Send(g_bb_trxc_conn_id, 
ts_TRXC_FAKE_TIMING(toffs256)));
+   f_sleep(0.5);
+
+   /* Transmit RACH request + wait for confirmation */
+   var OCT1 ra := f_rnd_ra_cs();
+   var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra));
+
+   /* Check for expected result */
+   timer T := 1.5;
+   T.start;
+   alt {
+   [expect_pass] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(ra, fn))) {
+   setverdict(pass);
+   }
+   [not expect_pass] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(ra, fn))) 
{
+   setverdict(fail, "RACH passed but was expected to be dropped");
+   }
+   [] RSL_CCHAN.receive { repeat; }
+   [not expect_pass] T.timeout {
+   setverdict(pass);
+   }
+   [expect_pass] T.timeout {
+   setverdict(fail, "Timeout waiting for CHAN RQD");
+   }
+   }
+}
+
+/* Test if dropping of RACH Based on NM_ATT_MAX_TA works */
+testcase TC_rach_max_ta() runs on test_CT {
+   f_init(testcasename());
+   f_init_l1ctl();
+   f_l1_tune(L1CTL);
+   f_main_trxc_connect();
+   f_sleep(1.0);
+
+   /* default max-ta is 63 (full range of GSM timing advance */
+
+   /* negative TA must not happen */
+   f_rach_toffs(-10*256, false);
+
+   /* 0 / 32 / 63 bits is legal / permitted */
+   f_rach_toffs(0, true);
+   f_rach_toffs(32*256, true);
+   f_rach_toffs(63*256, true);
+
+   /* more than 63 bits is not legal / permitted */
+   f_rach_toffs(64*256, false);
+   f_rach_toffs(127*256, false);
+}
 
 /***
  * Measurement Processing / Reporting
@@ -1731,6 +1794,7 @@
execute( TC_chan_act_wrong_nr() );
execute( TC_rach_content() );
execute( TC_rach_count() );
+   execute( TC_rach_max_ta() );
execute( TC_meas_res_sign_tchf() );
execute( TC_meas_res_sign_tchh() );
execute( TC_meas_res_sign_sdcch4() );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Idd7335f753f8b1a7d91274dc2c99d51d882309d3
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: bts: Instruct trxcon for TA=2 at every testcase start

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bts: Instruct trxcon for TA=2 at every testcase start
..


bts: Instruct trxcon for TA=2 at every testcase start

as fake_trx keeps running during the entire test suite run, and
the protocol being UDP based, it doesn't know when BTS_Test will
re-start and hence the old TA/FAKE_TIMING value will remain until
it is set.

Let's explicitly set a FAKE_TIMING of two bits at start-up of each
test case during f_init()

Change-Id: I9f07768346e0d68a4dbe36780e36b799d27a7f06
---
M bts/BTS_Tests.ttcn
1 file changed, 4 insertions(+), 1 deletion(-)

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



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 8800139..45fcb06 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -212,6 +212,10 @@
/* SI2 + SI4 are required for SI testing as they are mandatory defaults 
*/
f_rsl_bcch_fill(RSL_SYSTEM_INFO_2, ts_SI2_default);
f_rsl_bcch_fill(RSL_SYSTEM_INFO_4, ts_SI4_default);
+
+   /* start with a default moderate timing offset equalling TA=2 */
+   f_main_trxc_connect();
+   BB_TRXC.send(ts_TRXC_Send(g_bb_trxc_conn_id, 
ts_TRXC_FAKE_TIMING(2*256)));
 }
 
 /* Attach L1CTL to master test_CT (classic tests, non-handler mode) */
@@ -599,7 +603,6 @@
f_init(testcasename());
f_init_l1ctl();
f_l1_tune(L1CTL);
-   f_main_trxc_connect();
f_sleep(1.0);
 
/* default max-ta is 63 (full range of GSM timing advance */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9f07768346e0d68a4dbe36780e36b799d27a7f06
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: bts: Add TELNET/VTY module so we can interact with BTS VTY

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bts: Add TELNET/VTY module so we can interact with BTS VTY
..


bts: Add TELNET/VTY module so we can interact with BTS VTY

Change-Id: Ia1d6ba2c3534d2daaa5ea1fe60b32a99fa4ddad9
---
M bts/BTS_Tests.default
M bts/BTS_Tests.ttcn
M bts/gen_links.sh
M bts/regen_makefile.sh
4 files changed, 19 insertions(+), 4 deletions(-)

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



diff --git a/bts/BTS_Tests.default b/bts/BTS_Tests.default
index 927d7c4..562088b 100644
--- a/bts/BTS_Tests.default
+++ b/bts/BTS_Tests.default
@@ -15,7 +15,7 @@
 *.BTSVTY.PROMPT1 := "OsmoBTS> "
 
 [MODULE_PARAMETERS]
-//Osmocom_VTY_Functions.mp_prompt_prefix := "OsmoBTS";
+Osmocom_VTY_Functions.mp_prompt_prefix := "OsmoBTS";
 
 [EXECUTE]
 BTS_Tests.control
diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 45fcb06..261d969 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -27,6 +27,9 @@
 import from MobileL3_Types all;
 import from L3_Templates all;
 
+import from Osmocom_VTY_Functions all;
+import from TELNETasp_PortType all;
+
 /* The tests assume a BTS with the following timeslot configuration:
  * TS0 : Combined CCCH + SDCCH/4
  * TS1 .. TS 4: TCH/F
@@ -56,6 +59,8 @@
/* TRXC port (for classic tests) */
port TRXC_CODEC_PT BB_TRXC;
var integer g_bb_trxc_conn_id;
+
+   port TELNETasp_PT BTSVTY;
 
/* SI configuration */
var SystemInformationConfig si_cfg := {
@@ -201,11 +206,18 @@
f_rsl_bcch_fill_raw(rsl_si_type, si_enc);
 }
 
+private function f_init_vty(charstring id) runs on test_CT {
+   map(self:BTSVTY, system:BTSVTY);
+   f_vty_set_prompts(BTSVTY);
+   f_vty_transceive(BTSVTY, "enable");
+}
+
 /* global init function */
 function f_init(charstring id := "BTS-Test") runs on test_CT {
f_init_rsl(id);
RSL_CCHAN.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP});
f_sleep(0.5);   /* workaround for OS#3000 */
+   f_init_vty(id);
 
/* Send SI3 to the BTS, it is needed for various computations */
f_rsl_bcch_fill(RSL_SYSTEM_INFO_3, ts_SI3_default);
diff --git a/bts/gen_links.sh b/bts/gen_links.sh
index 66ffca3..253b757 100755
--- a/bts/gen_links.sh
+++ b/bts/gen_links.sh
@@ -35,8 +35,12 @@
 FILES="MobileL3_CC_Types.ttcn MobileL3_CommonIE_Types.ttcn 
MobileL3_GMM_SM_Types.ttcn MobileL3_MM_Types.ttcn MobileL3_RRM_Types.ttcn 
MobileL3_SMS_Types.ttcn MobileL3_SS_Types.ttcn MobileL3_Types.ttcn"
 gen_links $DIR $FILES
 
+DIR=$BASEDIR/titan.TestPorts.TELNETasp/src
+FILES="TELNETasp_PT.cc  TELNETasp_PT.hh  TELNETasp_PortType.ttcn"
+gen_links $DIR $FILES
+
 DIR=../library
-FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn 
GSM_SystemInformation.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn 
RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn 
L1CTL_PortType_CtrlFunct.ttcn L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn 
LAPDm_Types.ttcn "
+FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn 
Osmocom_VTY_Functions.ttcn GSM_SystemInformation.ttcn Osmocom_Types.ttcn 
RLCMAC_Types.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn 
L1CTL_PortType.ttcn L1CTL_PortType_CtrlFunct.ttcn 
L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
 #FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn 
NS_CodecPort_CtrlFunctDef.cc "
 #FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
 FILES+="IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn 
IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcnpp IPA_CodecPort.ttcn 
RSL_Types.ttcn RSL_Emulation.ttcn "
diff --git a/bts/regen_makefile.sh b/bts/regen_makefile.sh
index 46cc4ea..9ed5a06 100755
--- a/bts/regen_makefile.sh
+++ b/bts/regen_makefile.sh
@@ -1,7 +1,6 @@
 #!/bin/sh
 
-FILES="*.ttcn *.ttcnpp IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc 
IPL4asp_discovery.cc TCCConversion.cc
-TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc 
TRXC_CodecPort_CtrlFunctDef.cc L1CTL_PortType_CtrlFunctDef.cc"
+FILES="*.ttcn *.ttcnpp IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc 
IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc 
Native_FunctionDefs.cc TRXC_CodecPort_CtrlFunctDef.cc 
L1CTL_PortType_CtrlFunctDef.cc TELNETasp_PT.cc"
 
 export CPPFLAGS_TTCN3="-DIPA_EMULATION_RSL"
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia1d6ba2c3534d2daaa5ea1fe60b32a99fa4ddad9
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-ttcn3-hacks[master]: bts: Add TELNET/VTY module so we can interact with BTS VTY

2018-02-27 Thread Harald Welte

Patch Set 3: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: L1CTL: Add message segmentation helper via getMsgLen()

2018-02-27 Thread Harald Welte

Patch Set 3: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: bts: Add test for high-resulotion timing offset / TOA256

2018-02-27 Thread Harald Welte

Patch Set 3: Code-Review+2

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

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


[PATCH] osmo-ttcn3-hacks[master]: L1CTL: Add message segmentation helper via getMsgLen()

2018-02-27 Thread Harald Welte
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6922

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

L1CTL: Add message segmentation helper via getMsgLen()

As L1CTL is using a stream socket, we need to give the UNIX_DOMAIN
port some clue as to where our L1CTL message boundaries are in the
stream.

This requires a patched UNIX_DOMAIN_SOCKETasp test port with the
following commit applied:

commit 655cb4ab2ac006b3a73d1b679c83081d9743410a
Author: Harald Welte 
Date:   Sun Feb 25 23:25:46 2018 +0100

Add "getMsgLen" function similar to IPL4asp_PT

Change-Id: Iab33f57cb4311180e521a76307a552d16287b062
---
M bts/gen_links.sh
M bts/regen_makefile.sh
M deps/Makefile
M gprs_gb/gen_links.sh
M gprs_gb/regen_makefile.sh
M lapdm/gen_links.sh
M lapdm/regen_makefile.sh
M library/L1CTL_PortType.ttcn
A library/L1CTL_PortType_CtrlFunct.ttcn
A library/L1CTL_PortType_CtrlFunctDef.cc
10 files changed, 56 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/22/6922/3

diff --git a/bts/gen_links.sh b/bts/gen_links.sh
index eaafd19..66ffca3 100755
--- a/bts/gen_links.sh
+++ b/bts/gen_links.sh
@@ -36,7 +36,7 @@
 gen_links $DIR $FILES
 
 DIR=../library
-FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn 
GSM_SystemInformation.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn 
RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn 
LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
+FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn 
GSM_SystemInformation.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn 
RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn 
L1CTL_PortType_CtrlFunct.ttcn L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn 
LAPDm_Types.ttcn "
 #FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn 
NS_CodecPort_CtrlFunctDef.cc "
 #FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
 FILES+="IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn 
IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcnpp IPA_CodecPort.ttcn 
RSL_Types.ttcn RSL_Emulation.ttcn "
diff --git a/bts/regen_makefile.sh b/bts/regen_makefile.sh
index 3f11887..46cc4ea 100755
--- a/bts/regen_makefile.sh
+++ b/bts/regen_makefile.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 FILES="*.ttcn *.ttcnpp IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc 
IPL4asp_discovery.cc TCCConversion.cc
-TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc 
TRXC_CodecPort_CtrlFunctDef.cc"
+TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc 
TRXC_CodecPort_CtrlFunctDef.cc L1CTL_PortType_CtrlFunctDef.cc"
 
 export CPPFLAGS_TTCN3="-DIPA_EMULATION_RSL"
 
diff --git a/deps/Makefile b/deps/Makefile
index 1d9a6e6..d67e065 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -20,8 +20,7 @@
titan.TestPorts.SIPmsg \
titan.TestPorts.TCPasp \
titan.TestPorts.TELNETasp \
-   titan.TestPorts.UDPasp \
-   titan.TestPorts.UNIX_DOMAIN_SOCKETasp
+   titan.TestPorts.UDPasp
 
 ECLIPSEGIT2_REPOS= titan.ProtocolModules.GRE \
titan.ProtocolModules.M2PA \
@@ -40,7 +39,8 @@
titan.ProtocolModules.NS_v7.3.0 \
titan.ProtocolModules.SNDCP_v7.0.0
 
-OSMOGITHUB_REPOS=  titan.TestPorts.SCTPasp
+OSMOGITHUB_REPOS=  titan.TestPorts.SCTPasp \
+   titan.TestPorts.UNIX_DOMAIN_SOCKETasp
 
 ALL_REPOS=$(ECLIPSEGIT_REPOS) $(ECLIPSEGIT2_REPOS) $(OSMOGITHUB_REPOS)
 
diff --git a/gprs_gb/gen_links.sh b/gprs_gb/gen_links.sh
index 5cbaaae..54d2bdd 100755
--- a/gprs_gb/gen_links.sh
+++ b/gprs_gb/gen_links.sh
@@ -53,7 +53,7 @@
 
 
 DIR=../library
-FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn 
RLCMAC_Types.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn 
L1CTL_PortType.ttcn LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
+FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn 
RLCMAC_Types.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn 
L1CTL_PortType.ttcn L1CTL_PortType_CtrlFunct.ttcn 
L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
 FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn 
NS_CodecPort_CtrlFunctDef.cc "
 FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
 FILES+="LLC_Templates.ttcn L3_Templates.ttcn L3_Common.ttcn "
diff --git a/gprs_gb/regen_makefile.sh b/gprs_gb/regen_makefile.sh
index 8b79d73..e49618a 100755
--- a/gprs_gb/regen_makefile.sh
+++ b/gprs_gb/regen_makefile.sh
@@ -1,5 +1,5 @@
 #!/bin/sh
 
-FILES="*.ttcn BSSGP_EncDec.cc IPL4asp_PT.cc IPL4asp_discovery.cc 
TCCConversion.cc TCCInterface.cc NS_CodecPort_CtrlFunctDef.cc UD_PT.cc 
RLCMAC_EncDec.cc LLC_EncDec.cc"
+FILES="*.ttcn BSSGP_EncDec.cc IPL4asp_PT.cc IPL4asp_discovery.cc 
TCCConversion.cc TCCInterface.cc 

[PATCH] osmo-ttcn3-hacks[master]: L1CTL: Add message segmentation helper via getMsgLen()

2018-02-27 Thread Harald Welte
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6922

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

L1CTL: Add message segmentation helper via getMsgLen()

As L1CTL is using a stream socket, we need to give the UNIX_DOMAIN
port some clue as to where our L1CTL message boundaries are in the
stream.

This requires a patched UNIX_DOMAIN_SOCKETasp test port with the
following commit applied:

commit 655cb4ab2ac006b3a73d1b679c83081d9743410a
Author: Harald Welte 
Date:   Sun Feb 25 23:25:46 2018 +0100

Add "getMsgLen" function similar to IPL4asp_PT

Change-Id: Iab33f57cb4311180e521a76307a552d16287b062
---
M bts/gen_links.sh
M bts/regen_makefile.sh
M deps/Makefile
M library/L1CTL_PortType.ttcn
A library/L1CTL_PortType_CtrlFunct.ttcn
A library/L1CTL_PortType_CtrlFunctDef.cc
6 files changed, 49 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/22/6922/2

diff --git a/bts/gen_links.sh b/bts/gen_links.sh
index eaafd19..66ffca3 100755
--- a/bts/gen_links.sh
+++ b/bts/gen_links.sh
@@ -36,7 +36,7 @@
 gen_links $DIR $FILES
 
 DIR=../library
-FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn 
GSM_SystemInformation.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn 
RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn 
LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
+FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn 
GSM_SystemInformation.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn 
RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn 
L1CTL_PortType_CtrlFunct.ttcn L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn 
LAPDm_Types.ttcn "
 #FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn 
NS_CodecPort_CtrlFunctDef.cc "
 #FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
 FILES+="IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn 
IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcnpp IPA_CodecPort.ttcn 
RSL_Types.ttcn RSL_Emulation.ttcn "
diff --git a/bts/regen_makefile.sh b/bts/regen_makefile.sh
index 3f11887..46cc4ea 100755
--- a/bts/regen_makefile.sh
+++ b/bts/regen_makefile.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 FILES="*.ttcn *.ttcnpp IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc 
IPL4asp_discovery.cc TCCConversion.cc
-TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc 
TRXC_CodecPort_CtrlFunctDef.cc"
+TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc 
TRXC_CodecPort_CtrlFunctDef.cc L1CTL_PortType_CtrlFunctDef.cc"
 
 export CPPFLAGS_TTCN3="-DIPA_EMULATION_RSL"
 
diff --git a/deps/Makefile b/deps/Makefile
index 1d9a6e6..d67e065 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -20,8 +20,7 @@
titan.TestPorts.SIPmsg \
titan.TestPorts.TCPasp \
titan.TestPorts.TELNETasp \
-   titan.TestPorts.UDPasp \
-   titan.TestPorts.UNIX_DOMAIN_SOCKETasp
+   titan.TestPorts.UDPasp
 
 ECLIPSEGIT2_REPOS= titan.ProtocolModules.GRE \
titan.ProtocolModules.M2PA \
@@ -40,7 +39,8 @@
titan.ProtocolModules.NS_v7.3.0 \
titan.ProtocolModules.SNDCP_v7.0.0
 
-OSMOGITHUB_REPOS=  titan.TestPorts.SCTPasp
+OSMOGITHUB_REPOS=  titan.TestPorts.SCTPasp \
+   titan.TestPorts.UNIX_DOMAIN_SOCKETasp
 
 ALL_REPOS=$(ECLIPSEGIT_REPOS) $(ECLIPSEGIT2_REPOS) $(OSMOGITHUB_REPOS)
 
diff --git a/library/L1CTL_PortType.ttcn b/library/L1CTL_PortType.ttcn
index b82419e..4dcacb8 100644
--- a/library/L1CTL_PortType.ttcn
+++ b/library/L1CTL_PortType.ttcn
@@ -6,6 +6,7 @@
import from Osmocom_Types all;
import from GSM_Types all;
import from GSM_RR_Types all;
+   import from L1CTL_PortType_CtrlFunct all;
 
type record L1CTL_connect {
charstring  path
@@ -18,6 +19,18 @@
 
modulepar {
charstring  m_l1ctl_sock_path := "/tmp/osmocom_l2";
+   }
+
+   function f_L1CTL_getMsgLen(in octetstring stream, inout ro_integer 
args) return integer {
+   var integer stream_len := lengthof(stream);
+   var integer len;
+   if (stream_len < 2) {
+   log("getMsgLen(", stream, ",", args, ")=-1");
+   return -1;
+   }
+   len := 2 + oct2int(substr(stream, 0, 2));
+   log("getMsgLen(", stream, ",", args, ")=", len);
+   return len;
}
 
function f_L1CTL_FBSB(L1CTL_PT pt, Arfcn arfcn, L1ctlCcchMode ccch_mode 
:= CCCH_MODE_COMBINED) {
@@ -88,8 +101,11 @@
}
 
function f_connect_reset(L1CTL_PT pt, charstring l1ctl_sock_path := 
m_l1ctl_sock_path) {
+   var f_UD_getMsgLen vl_f := refers(f_L1CTL_getMsgLen);
+   f_L1CTL_setGetMsgLen(pt, -1, vl_f, {});

[PATCH] osmo-ttcn3-hacks[master]: bts: Add TELNET/VTY module so we can interact with BTS VTY

2018-02-27 Thread Harald Welte

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

bts: Add TELNET/VTY module so we can interact with BTS VTY

Change-Id: Ia1d6ba2c3534d2daaa5ea1fe60b32a99fa4ddad9
---
M bts/BTS_Tests.default
M bts/BTS_Tests.ttcn
M bts/gen_links.sh
M bts/regen_makefile.sh
4 files changed, 19 insertions(+), 4 deletions(-)


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

diff --git a/bts/BTS_Tests.default b/bts/BTS_Tests.default
index 927d7c4..562088b 100644
--- a/bts/BTS_Tests.default
+++ b/bts/BTS_Tests.default
@@ -15,7 +15,7 @@
 *.BTSVTY.PROMPT1 := "OsmoBTS> "
 
 [MODULE_PARAMETERS]
-//Osmocom_VTY_Functions.mp_prompt_prefix := "OsmoBTS";
+Osmocom_VTY_Functions.mp_prompt_prefix := "OsmoBTS";
 
 [EXECUTE]
 BTS_Tests.control
diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 45fcb06..261d969 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -27,6 +27,9 @@
 import from MobileL3_Types all;
 import from L3_Templates all;
 
+import from Osmocom_VTY_Functions all;
+import from TELNETasp_PortType all;
+
 /* The tests assume a BTS with the following timeslot configuration:
  * TS0 : Combined CCCH + SDCCH/4
  * TS1 .. TS 4: TCH/F
@@ -56,6 +59,8 @@
/* TRXC port (for classic tests) */
port TRXC_CODEC_PT BB_TRXC;
var integer g_bb_trxc_conn_id;
+
+   port TELNETasp_PT BTSVTY;
 
/* SI configuration */
var SystemInformationConfig si_cfg := {
@@ -201,11 +206,18 @@
f_rsl_bcch_fill_raw(rsl_si_type, si_enc);
 }
 
+private function f_init_vty(charstring id) runs on test_CT {
+   map(self:BTSVTY, system:BTSVTY);
+   f_vty_set_prompts(BTSVTY);
+   f_vty_transceive(BTSVTY, "enable");
+}
+
 /* global init function */
 function f_init(charstring id := "BTS-Test") runs on test_CT {
f_init_rsl(id);
RSL_CCHAN.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP});
f_sleep(0.5);   /* workaround for OS#3000 */
+   f_init_vty(id);
 
/* Send SI3 to the BTS, it is needed for various computations */
f_rsl_bcch_fill(RSL_SYSTEM_INFO_3, ts_SI3_default);
diff --git a/bts/gen_links.sh b/bts/gen_links.sh
index 66ffca3..253b757 100755
--- a/bts/gen_links.sh
+++ b/bts/gen_links.sh
@@ -35,8 +35,12 @@
 FILES="MobileL3_CC_Types.ttcn MobileL3_CommonIE_Types.ttcn 
MobileL3_GMM_SM_Types.ttcn MobileL3_MM_Types.ttcn MobileL3_RRM_Types.ttcn 
MobileL3_SMS_Types.ttcn MobileL3_SS_Types.ttcn MobileL3_Types.ttcn"
 gen_links $DIR $FILES
 
+DIR=$BASEDIR/titan.TestPorts.TELNETasp/src
+FILES="TELNETasp_PT.cc  TELNETasp_PT.hh  TELNETasp_PortType.ttcn"
+gen_links $DIR $FILES
+
 DIR=../library
-FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn 
GSM_SystemInformation.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn 
RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn L1CTL_PortType.ttcn 
L1CTL_PortType_CtrlFunct.ttcn L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn 
LAPDm_Types.ttcn "
+FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn 
Osmocom_VTY_Functions.ttcn GSM_SystemInformation.ttcn Osmocom_Types.ttcn 
RLCMAC_Types.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn 
L1CTL_PortType.ttcn L1CTL_PortType_CtrlFunct.ttcn 
L1CTL_PortType_CtrlFunctDef.cc LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
 #FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn 
NS_CodecPort_CtrlFunctDef.cc "
 #FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
 FILES+="IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn 
IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcnpp IPA_CodecPort.ttcn 
RSL_Types.ttcn RSL_Emulation.ttcn "
diff --git a/bts/regen_makefile.sh b/bts/regen_makefile.sh
index 46cc4ea..9ed5a06 100755
--- a/bts/regen_makefile.sh
+++ b/bts/regen_makefile.sh
@@ -1,7 +1,6 @@
 #!/bin/sh
 
-FILES="*.ttcn *.ttcnpp IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc 
IPL4asp_discovery.cc TCCConversion.cc
-TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc 
TRXC_CodecPort_CtrlFunctDef.cc L1CTL_PortType_CtrlFunctDef.cc"
+FILES="*.ttcn *.ttcnpp IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc 
IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc UD_PT.cc RLCMAC_EncDec.cc 
Native_FunctionDefs.cc TRXC_CodecPort_CtrlFunctDef.cc 
L1CTL_PortType_CtrlFunctDef.cc TELNETasp_PT.cc"
 
 export CPPFLAGS_TTCN3="-DIPA_EMULATION_RSL"
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia1d6ba2c3534d2daaa5ea1fe60b32a99fa4ddad9
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] osmo-ttcn3-hacks[master]: bts: Add test for high-resulotion timing offset / TOA256

2018-02-27 Thread Harald Welte

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

bts: Add test for high-resulotion timing offset / TOA256

this adds a new test that uses VTY to enable TOA256 support in
the uplink supplementary measurement and then tests TCH/H measurement
reports

Change-Id: Id39a71429596d46289a82e539796308816ad86f3
---
M bts/BTS_Tests.ttcn
1 file changed, 20 insertions(+), 0 deletions(-)


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

diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 261d969..e68a20d 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -349,6 +349,7 @@
t_guard := t_guard,
l1_pars := {
dtx_enabled := false,
+   toa256_enabled := false,
meas_ul := {
full := {
rxlev := dbm2rxlev(-53),
@@ -689,6 +690,7 @@
 
 type record ConnL1Pars {
boolean dtx_enabled,
+   boolean toa256_enabled,
MeasElemFS meas_ul,
int16_t timing_offset_256syms,
uint5_t bs_power_level,
@@ -716,6 +718,10 @@
rxq_s_u := l1p.meas_ul.sub.rxqual,
supp_meas_info := omit
};
+   if (l1p.toa256_enabled) {
+   ul_meas.len := 5;
+   ul_meas.supp_meas_info := int2oct(l1p.timing_offset_256syms, 2);
+   }
/* HACK HACK HACK FIXME HACK HACK HACK see 
https://osmocom.org/issues/2988 */
ul_meas.rxlev_f_u := ?;
ul_meas.rxlev_s_u := ?;
@@ -872,6 +878,19 @@
vc_conn.done;
}
 }
+testcase TC_meas_res_sign_tchh_toa256() runs on test_CT {
+   var ConnHdlr vc_conn;
+   var ConnHdlrPars pars;
+   f_init(testcasename());
+   f_vty_config(BTSVTY, "bts 0", "supp-meas-info toa256");
+   for (var integer ss := 0; ss <= 1; ss := ss+1) {
+   pars := valueof(t_Pars(t_RslChanNr_Lm(5, ss), 
ts_RSL_ChanMode_SIGN));
+   pars.l1_pars.toa256_enabled := true;
+   vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), 
pars);
+   vc_conn.done;
+   }
+}
+
 
 /* Test if a channel without valid uplink bursts generates RSL CONN FAIL IND */
 private function f_TC_conn_fail_crit(charstring id) runs on ConnHdlr {
@@ -1813,6 +1832,7 @@
execute( TC_meas_res_sign_tchh() );
execute( TC_meas_res_sign_sdcch4() );
execute( TC_meas_res_sign_sdcch8() );
+   execute( TC_meas_res_sign_tchh_toa256() );
execute( TC_conn_fail_crit() );
execute( TC_paging_imsi_80percent() );
execute( TC_paging_tmsi_80percent() );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id39a71429596d46289a82e539796308816ad86f3
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


osmocom-bb[fixeria/trx]: fake_trx/ctrl_if_bb.py: add FAKE_RSSI and FAKE_TOA commands

2018-02-27 Thread Harald Welte

Patch Set 2: Code-Review-1

actually, I think setting an absolute value is not a good idea.  We should be 
able to set/configure a _delta_ value.  In this case we can do full/proper TA 
loop testing:
* trxcon sends with toa=0
* fake_trx adds e.g. 512 (2 bits)
* osmo-bts sends TA=2 in downlink SACCH
* "mobile" can tell trxcon to send with toa=-512 (-2*256)
* fake-trx adds -512+512=0
* osmo-bts receives TOA=0 which is expected if the timing advance loop is 
balanced.

what do you think?  How do you currently handle TA with the SDR PHY for 
osmcoom-bb?

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia23becec4104d47e7b22350db67b8834d6f1ad1b
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: fixeria/trx
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


libosmocore[master]: core/logging.h: Add logging category for jitter buffer

2018-02-27 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I2434f9dfa401f736bc62a2ddce920e587cd8c517
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] libosmocore[master]: core/logging.h: Add logging category for jitter buffer

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: core/logging.h: Add logging category for jitter buffer
..


core/logging.h: Add logging category for jitter buffer

Forthcoming jitter buffer code in libosmo-netif will make use of it.

Change-Id: I2434f9dfa401f736bc62a2ddce920e587cd8c517
---
M include/osmocom/core/logging.h
M src/logging.c
2 files changed, 7 insertions(+), 1 deletion(-)

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



diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h
index 617d78e..e68f618 100644
--- a/include/osmocom/core/logging.h
+++ b/include/osmocom/core/logging.h
@@ -121,7 +121,8 @@
 #define DLSUA  -15 /*!< Osmocom SUA */
 #define DLM3UA -16 /*!< Osmocom M3UA */
 #define DLMGCP -17 /*!< Osmocom MGCP */
-#define OSMO_NUM_DLIB  17  /*!< Number of logging sub-systems in libraries 
*/
+#define DLJIBUF-18 /*!< Osmocom Jitter Buffer */
+#define OSMO_NUM_DLIB  18  /*!< Number of logging sub-systems in libraries 
*/
 
 /*! Configuration of single log category / sub-system */
 struct log_category {
diff --git a/src/logging.c b/src/logging.c
index 66074ea..147b1fb 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -168,6 +168,11 @@
.description = "libosmo-mgcp Media Gateway Control Protocol",
.enabled = 1, .loglevel = LOGL_NOTICE,
},
+   [INT2IDX(DLJIBUF)] = {
+   .name = "DLJIBUF",
+   .description = "libosmo-netif Jitter Buffer",
+   .enabled = 1, .loglevel = LOGL_NOTICE,
+   },
 };
 
 /*! descriptive string for each log level */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2434f9dfa401f736bc62a2ddce920e587cd8c517
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-bts[master]: Add high-accuracy ToA value to Uplink Measurement Reports

2018-02-27 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-bts[master]: measurement: Keep average of high-accurate ToA value in lchan

2018-02-27 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ci[master]: osmo-clean-workspace: fix force checkout of a subdirectory

2018-02-27 Thread Neels Hofmeyr

Patch Set 1: Code-Review+2

ah good catch... now we just need someone to run it and mark +V, can also be 
you yourself, lynxis.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: If23e89872edf48dc5b751b3c069faf585bd6a3ef
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


libosmocore[master]: support for more cell ID list types in libosmocore

2018-02-27 Thread Neels Hofmeyr

Patch Set 9: Code-Review-1

(16 comments)

erm, sorry to bombard with another burst of comments. Many are purely cosmetic, 
a few notable ones in-between. I believe you can tell the difference and make 
your choices...

https://gerrit.osmocom.org/#/c/6509/9/include/osmocom/gsm/gsm0808_utils.h
File include/osmocom/gsm/gsm0808_utils.h:

Line 32: #define GSM0808_CELL_ID_LIST2_MAXLEN   128
from (255-1)/2 the theoretical max is 127, would be nice to explain that in the 
comment?


Line 47:} id_list;
why not just {...}id_list[MAXLEN] once? the size will be the same and it's less 
code repetition.

also thinking, since we have ARRAY_SIZE(), we could just define id_list[127] 
without a separate #define.


Line 73: /* deprecated */
we have an OSMO_DEPRECATED() macro to mark with a compiler warning. The only 
reason I am sometimes careful with those is that some of our builds now fail on 
any warnings. Actually we might want to make deprecation warnings non-fatal, so 
that we don't refrain from marking deprecation properly (like I'm doing lately, 
unfortunately).


https://gerrit.osmocom.org/#/c/6509/9/include/osmocom/gsm/protocol/gsm_08_08.h
File include/osmocom/gsm/protocol/gsm_08_08.h:

Line 505:  * DEPRECATED: This definition of the cell identifier list is
maybe rather move this down to the struct, I think doxygen will otherwise 
associate it with the #define instead of the struct. (I'm not sure whether the 
OSMO_DEPRECATED() also works with structs, so far used it only with functions)


https://gerrit.osmocom.org/#/c/6509/9/src/gsm/gsm0808.c
File src/gsm/gsm0808.c:

Line 509:   /* Mandatory elements! */
rofl emelents ... technically an unrelated cosmetic


Line 553:  * Create BSSMAP PAGING message
make sure to put full-stops at the end of sentences for doxygen parsing. Often 
it might not be strictly necessary, but rather do it always. (to indicate 
end-of-brief, end-of-param-doc etc)


Line 565:   /* Mandatory emelents! */
rofl squared, seriously? :D


Line 571:   memset(, 0, sizeof(cil2));
since holger pointed me at it, I like to use constructs like

  cil2 = (struct gsm0808_cell_id_list2){};

Above in the declaration, you can do it even without naming the struct again:

  struct gsm0808_cell_id_list2 cil2 = {};

This guarantees to init all members to their "constructor" value, in practice 
always zero.


Line 573:   memcpy(cil2.id_list.id_list_lac, cil->id_list_lac, 
cil->id_list_len * sizeof(cil2.id_list.id_list_lac[0]));
why not just copy the whole array, used or not. Otherwise you have to validate 
that id_list_len has a proper value to avoid copying past the array end. Well, 
probably want that too somewhere, not necessarily needs to be here though.

Also you should probably add somewhere:

  osmo_static_assert(some_name, ARRAY_SIZE(cil2.id_list) >= 
ARRAY_SIZE(cil.id_list));

(sprinkle syntactic elements in the fashion of '((struct xxx_list2*)0)->' as 
needed, see other static assertions).

(osmo_static_assert can also live outside of function scopes.)


https://gerrit.osmocom.org/#/c/6509/9/src/gsm/gsm0808_utils.c
File src/gsm/gsm0808_utils.c:

Line 595:   for (i = 0; i < cil->id_list_len; i++) {
we could have a single for loop outside the switch ... ok granted, it's less 
code but runs the switch for each iteration. ok then forget it, micro 
optimisation vs code cosmetics, doesn't matter.


Line 600:   msgb_put_u16(msg, id->cell_identity);
the parsing function puts each single parsing section in its separate function. 
The encoding function here contains all the encoding directly in the switch(). 
Does it makes sense to also put the encoding of single elements separately? Or, 
to also put the parsing all in the switch below?


Line 632:   OSMO_ASSERT(false);
will an incoming message with an unsupported list type be able to crash the 
program? Maybe rather return -ENOTSUP? hmm, but this function is defined to not 
return errors ever.


Line 689:   return gsm48_decode_lai(, mcc, mnc, lac) != 0 ? -1 : 0;
(i'd drop the '!= 0', to me it makes it look like it is intended to reverse the 
logic but is just the same as without it)


Line 855:   /* One byte for the cell ID descriminator + any remaining bytes 
in
"discriminator"


https://gerrit.osmocom.org/#/c/6509/9/tests/gsm0808/gsm0808_test.c
File tests/gsm0808/gsm0808_test.c:

Line 816:   memset(_cil, 0, sizeof(enc_cil));
just put ' = {};' above. Ah it's old code, doesn't matter which way then.


Line 817:   enc_cil.id_discr = CELL_IDENT_BSS;
ha! this a bugfix?


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb
Gerrit-PatchSet: 9
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder

osmo-bts[master]: L1SAP: Increase resolution of reported burst timing

2018-02-27 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


[MERGED] osmo-bts[master]: L1SAP: Increase resolution of reported burst timing

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: L1SAP: Increase resolution of reported burst timing
..


L1SAP: Increase resolution of reported burst timing

Before this patch we had:
* osmo-bts-trx internally using 1/256th bit/symbol period
* osmo-bts-sysmo internally using 1/4 bit/smbol period
* PCU interface using 1/4
* L1SAP interface using 1/4
* measurement processing code on top of L1SAP using 1/256

So for sysmo/lc15/octphy we are not loosing resolution, but for
osmo-bts-trx we're arbitrarily reducing the resolution via L1SAP
only then to compute with higher resolution again.

Let's change L1SAP to use 1/256 bits and hence not loose any resolution.
This requires a corresponding change in libosmocore for l1sap.h, which
is found in Change-Id Ibb58113c2819fe2d6d23ecbcfb8b3fce4055025d

Change-Id: If9b0f617845ba6c4aa47969f521734388197c9a7
---
M include/osmo-bts/scheduler_backend.h
M src/common/l1sap.c
M src/common/scheduler.c
M src/osmo-bts-litecell15/l1_if.c
M src/osmo-bts-octphy/l1_if.c
M src/osmo-bts-sysmo/l1_if.c
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-virtual/l1_if.c
8 files changed, 19 insertions(+), 19 deletions(-)

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



diff --git a/include/osmo-bts/scheduler_backend.h 
b/include/osmo-bts/scheduler_backend.h
index 5f11f9b..dbd9319 100644
--- a/include/osmo-bts/scheduler_backend.h
+++ b/include/osmo-bts/scheduler_backend.h
@@ -51,7 +51,7 @@
 int _sched_compose_ph_data_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t 
fn,
   enum trx_chan_type chan, uint8_t *l2,
   uint8_t l2_len, float rssi,
-  int16_t ta_offs_qbits, int16_t link_qual_cb,
+  int16_t ta_offs_256bits, int16_t link_qual_cb,
   uint16_t ber10k,
   enum osmo_ph_pres_info_type presence_info);
 
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index e095417..330b40a 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -512,8 +512,8 @@
}
 
DEBUGPFN(DL1P, info_meas_ind->fn,
-   "%s MPH_INFO meas ind, ta_offs_qbits=%d, ber10k=%d, 
inv_rssi=%u\n",
-   gsm_lchan_name(lchan), info_meas_ind->ta_offs_qbits,
+   "%s MPH_INFO meas ind, ta_offs_256bits=%d, ber10k=%d, 
inv_rssi=%u\n",
+   gsm_lchan_name(lchan), info_meas_ind->ta_offs_256bits,
info_meas_ind->ber10k, info_meas_ind->inv_rssi);
 
/* in the GPRS case we are not interested in measurement
@@ -522,13 +522,13 @@
return 0;
 
memset(, 0, sizeof(ulm));
-   ulm.ta_offs_256bits = info_meas_ind->ta_offs_qbits*(256/4);
+   ulm.ta_offs_256bits = info_meas_ind->ta_offs_256bits;
ulm.ber10k = info_meas_ind->ber10k;
ulm.inv_rssi = info_meas_ind->inv_rssi;
ulm.is_sub = info_meas_ind->is_sub;
 
/* we assume that symbol period is 1 bit: */
-   set_ms_to_data(lchan, info_meas_ind->ta_offs_qbits / 4, true);
+   set_ms_to_data(lchan, info_meas_ind->ta_offs_256bits / 256, true);
 
lchan_new_ul_meas(lchan, , info_meas_ind->fn);
 
@@ -1058,7 +1058,7 @@
pcu_tx_data_ind(>ts[tn], PCU_IF_SAPI_PTCCH, fn,
0 /* ARFCN */, L1SAP_FN2PTCCHBLOCK(fn),
data, len, rssi, data_ind->ber10k,
-   data_ind->ta_offs_qbits,
+   data_ind->ta_offs_256bits/64,
data_ind->lqual_cb);
} else {
/* drop incomplete UL block */
@@ -1067,7 +1067,7 @@
/* PDTCH / PACCH frame handling */
pcu_tx_data_ind(>ts[tn], PCU_IF_SAPI_PDTCH, fn, 0 
/* ARFCN */,
L1SAP_FN2MACBLOCK(fn), data, len, rssi, 
data_ind->ber10k,
-   data_ind->ta_offs_qbits, 
data_ind->lqual_cb);
+   data_ind->ta_offs_256bits/64, 
data_ind->lqual_cb);
}
return 0;
}
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index edd99d2..8c9d30d 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -340,7 +340,7 @@
 int _sched_compose_ph_data_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t 
fn,
   enum trx_chan_type chan, uint8_t *l2,
   uint8_t l2_len, float rssi,
-  int16_t ta_offs_qbits, int16_t link_qual_cb,
+  int16_t ta_offs_256bits, int16_t link_qual_cb,
   uint16_t ber10k,
   enum osmo_ph_pres_info_type presence_info)
 {
@@ -359,7 

[MERGED] libosmocore[master]: l1sap: Add fields for higher-precision timing offset values

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: l1sap: Add fields for higher-precision timing offset values
..


l1sap: Add fields for higher-precision timing offset values

So far, we used quarter-bits across the L1SAP between the hardware/PHY
specific part of OsmoBTS and the common part.  In order to increase
the resolution, let's add fields/members for 1/256th bit.

In order to keep ABI and API compatibility, we use a union around the
old and new values, so old code will still compile + work withe new
libosmocore.

Change-Id: Ibb58113c2819fe2d6d23ecbcfb8b3fce4055025d
---
M include/osmocom/gsm/l1sap.h
1 file changed, 8 insertions(+), 2 deletions(-)

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



diff --git a/include/osmocom/gsm/l1sap.h b/include/osmocom/gsm/l1sap.h
index 18ad7d2..9a9c008 100644
--- a/include/osmocom/gsm/l1sap.h
+++ b/include/osmocom/gsm/l1sap.h
@@ -77,7 +77,10 @@
uint32_t fn;/*!< GSM Frame Number */
int8_t rssi;/*!< RSSI of receivedindication */
uint16_t ber10k;/*!< BER in units of 0.01% */
-   int16_t ta_offs_qbits;  /* !< Burst TA Offset in quarter bits */
+   union {
+   int16_t ta_offs_qbits;  /* !< Burst TA Offset in quarter bits */
+   int16_t ta_offs_256bits;/*!< timing advance offset (in 1/256th 
bits) */
+   };
int16_t lqual_cb;   /* !< Link quality in centiBel */
enum osmo_ph_pres_info_type pdch_presence_info; /*!< Info regarding 
presence/validity of header and data parts */
 };
@@ -107,7 +110,10 @@
uint8_t chan_nr;/*!< Channel Number (Like RSL) */
uint32_t fn;/*!< GSM Frame Number */
uint16_t ber10k;/*!< BER in units of 0.01% */
-   int16_t ta_offs_qbits;  /*!< timing advance offset (in qbits) */
+   union {
+   int16_t ta_offs_qbits;  /*!< timing advance offset (in qbits) */
+   int16_t ta_offs_256bits;/*!< timing advance offset (in 1/256th 
bits) */
+   };
int16_t c_i_cb; /*!< C/I ratio in 0.1 dB */
uint8_t is_sub:1;   /*!< flags */
uint8_t inv_rssi;   /*!< RSSI in dBm * -1 */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibb58113c2819fe2d6d23ecbcfb8b3fce4055025d
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


libosmocore[master]: l1sap: Add fields for higher-precision timing offset values

2018-02-27 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[PATCH] libosmocore[master]: l1sap: Add fields for higher-precision timing offset values

2018-02-27 Thread Harald Welte

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

l1sap: Add fields for higher-precision timing offset values

So far, we used quarter-bits across the L1SAP between the hardware/PHY
specific part of OsmoBTS and the common part.  In order to increase
the resolution, let's add fields/members for 1/256th bit.

In order to keep ABI and API compatibility, we use a union around the
old and new values, so old code will still compile + work withe new
libosmocore.

Change-Id: Ibb58113c2819fe2d6d23ecbcfb8b3fce4055025d
---
M include/osmocom/gsm/l1sap.h
1 file changed, 8 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/72/6972/1

diff --git a/include/osmocom/gsm/l1sap.h b/include/osmocom/gsm/l1sap.h
index 18ad7d2..9a9c008 100644
--- a/include/osmocom/gsm/l1sap.h
+++ b/include/osmocom/gsm/l1sap.h
@@ -77,7 +77,10 @@
uint32_t fn;/*!< GSM Frame Number */
int8_t rssi;/*!< RSSI of receivedindication */
uint16_t ber10k;/*!< BER in units of 0.01% */
-   int16_t ta_offs_qbits;  /* !< Burst TA Offset in quarter bits */
+   union {
+   int16_t ta_offs_qbits;  /* !< Burst TA Offset in quarter bits */
+   int16_t ta_offs_256bits;/*!< timing advance offset (in 1/256th 
bits) */
+   };
int16_t lqual_cb;   /* !< Link quality in centiBel */
enum osmo_ph_pres_info_type pdch_presence_info; /*!< Info regarding 
presence/validity of header and data parts */
 };
@@ -107,7 +110,10 @@
uint8_t chan_nr;/*!< Channel Number (Like RSL) */
uint32_t fn;/*!< GSM Frame Number */
uint16_t ber10k;/*!< BER in units of 0.01% */
-   int16_t ta_offs_qbits;  /*!< timing advance offset (in qbits) */
+   union {
+   int16_t ta_offs_qbits;  /*!< timing advance offset (in qbits) */
+   int16_t ta_offs_256bits;/*!< timing advance offset (in 1/256th 
bits) */
+   };
int16_t c_i_cb; /*!< C/I ratio in 0.1 dB */
uint8_t is_sub:1;   /*!< flags */
uint8_t inv_rssi;   /*!< RSSI in dBm * -1 */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibb58113c2819fe2d6d23ecbcfb8b3fce4055025d
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[MERGED] osmo-bts[master]: measurement.c: higher-precision TA/TOA math

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: measurement.c: higher-precision TA/TOA math
..


measurement.c: higher-precision TA/TOA math

Change-Id: I0dc8e78545465dfc5c93691a49b86b6b8b56b432
---
M include/osmo-bts/gsm_data_shared.h
M src/common/l1sap.c
M src/common/measurement.c
3 files changed, 8 insertions(+), 8 deletions(-)

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



diff --git a/include/osmo-bts/gsm_data_shared.h 
b/include/osmo-bts/gsm_data_shared.h
index 7cefb10..770aea8 100644
--- a/include/osmo-bts/gsm_data_shared.h
+++ b/include/osmo-bts/gsm_data_shared.h
@@ -165,8 +165,8 @@
 struct bts_ul_meas {
/* BER in units of 0.01%: 10.000 == 100% ber, 0 == 0% ber */
uint16_t ber10k;
-   /* timing advance offset (in quarter bits) */
-   int16_t ta_offs_qbits;
+   /* timing advance offset (in 1/256 bits) */
+   int16_t ta_offs_256bits;
/* C/I ratio in dB */
float c_i;
/* flags */
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 50bd612..e095417 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -522,7 +522,7 @@
return 0;
 
memset(, 0, sizeof(ulm));
-   ulm.ta_offs_qbits = info_meas_ind->ta_offs_qbits;
+   ulm.ta_offs_256bits = info_meas_ind->ta_offs_qbits*(256/4);
ulm.ber10k = info_meas_ind->ber10k;
ulm.inv_rssi = info_meas_ind->inv_rssi;
ulm.is_sub = info_meas_ind->is_sub;
diff --git a/src/common/measurement.c b/src/common/measurement.c
index 98d9403..bdb2850 100644
--- a/src/common/measurement.c
+++ b/src/common/measurement.c
@@ -342,7 +342,7 @@
uint32_t irssi_full_sum = 0;
uint32_t ber_sub_sum = 0;
uint32_t irssi_sub_sum = 0;
-   int32_t taqb_sum = 0;
+   int32_t ta256b_sum = 0;
unsigned int num_meas_sub = 0;
int i;
 
@@ -362,7 +362,7 @@
 
ber_full_sum += m->ber10k;
irssi_full_sum += m->inv_rssi;
-   taqb_sum += m->ta_offs_qbits;
+   ta256b_sum += m->ta_offs_256bits;
 
if (m->is_sub) {
num_meas_sub++;
@@ -374,7 +374,7 @@
/* step 2: divide */
ber_full_sum = ber_full_sum / lchan->meas.num_ul_meas;
irssi_full_sum = irssi_full_sum / lchan->meas.num_ul_meas;
-   taqb_sum = taqb_sum / lchan->meas.num_ul_meas;
+   ta256b_sum = ta256b_sum / lchan->meas.num_ul_meas;
 
if (num_meas_sub) {
ber_sub_sum = ber_sub_sum / num_meas_sub;
@@ -387,9 +387,9 @@
irssi_sub_sum = 120; /* -120 dBm */
}
 
-   LOGP(DMEAS, LOGL_INFO, "%s Computed TA(% 4dqb) BER-FULL(%2u.%02u%%), 
RSSI-FULL(-%3udBm), "
+   LOGP(DMEAS, LOGL_INFO, "%s Computed TA256(% 4d) BER-FULL(%2u.%02u%%), 
RSSI-FULL(-%3udBm), "
"BER-SUB(%2u.%02u%%), RSSI-SUB(-%3udBm)\n", 
gsm_lchan_name(lchan),
-   taqb_sum, ber_full_sum/100,
+   ta256b_sum, ber_full_sum/100,
ber_full_sum%100, irssi_full_sum, ber_sub_sum/100, 
ber_sub_sum%100,
irssi_sub_sum);
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0dc8e78545465dfc5c93691a49b86b6b8b56b432
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-bts[master]: measurement.c: higher-precision TA/TOA math

2018-02-27 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


[MERGED] osmo-bts[master]: trx/scheduler: Use integer math for TOA (Timing of Arrival)

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: trx/scheduler: Use integer math for TOA (Timing of Arrival)
..


trx/scheduler: Use integer math for TOA (Timing of Arrival)

There's no need to express TOA as a float:
* We receive it as signed 16bit integer in units 1/256 symbol periods
* We pass it to L1SAP as signed integer in 1/4 symbol periods

So turn it into an int16_t with 1/256 symbol period accuracy throughout
the code to avoid both float arithmetic as well as loosing any precision.

Change-Id: Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec
---
M include/osmo-bts/scheduler.h
M include/osmo-bts/scheduler_backend.h
M src/common/scheduler.c
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-trx/l1_if.h
M src/osmo-bts-trx/loops.c
M src/osmo-bts-trx/loops.h
M src/osmo-bts-trx/scheduler_trx.c
M src/osmo-bts-trx/trx_if.c
M src/osmo-bts-virtual/scheduler_virtbts.c
10 files changed, 74 insertions(+), 71 deletions(-)

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



diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 4d34315..98f38d3 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -75,7 +75,7 @@
uint8_t rssi_num;   /* number of RSSI values */
float   rssi_sum;   /* sum of RSSI values */
uint8_t toa_num;/* number of TOA values */
-   float   toa_sum;/* sum of TOA values */
+   int32_t toa256_sum; /* sum of TOA values (1/256 
symbol) */
 
/* loss detection */
uint8_t lost;   /* (SACCH) loss detection */
@@ -113,7 +113,7 @@
int rssi_count; /* received RSSI values */
int rssi_valid_count; /* number of stored value */
int rssi_got_burst; /* any burst received so far */
-   float   toa_sum;/* sum of TOA values */
+   int32_t toa256_sum; /* sum of TOA values (1/256 
symbol) */
int toa_num;/* number of TOA value */
} meas;
 
@@ -165,7 +165,7 @@
 
 /*! \brief handle an UL burst received by PHY */
 int trx_sched_ul_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
-sbit_t *bits, uint16_t nbits, int8_t rssi, float toa);
+sbit_t *bits, uint16_t nbits, int8_t rssi, int16_t toa);
 
 /*! \brief set multiframe scheduler to given physical channel config */
 int trx_sched_set_pchan(struct l1sched_trx *l1t, uint8_t tn,
diff --git a/include/osmo-bts/scheduler_backend.h 
b/include/osmo-bts/scheduler_backend.h
index 5e077ef..5f11f9b 100644
--- a/include/osmo-bts/scheduler_backend.h
+++ b/include/osmo-bts/scheduler_backend.h
@@ -16,7 +16,7 @@
 typedef int trx_sched_ul_func(struct l1sched_trx *l1t, uint8_t tn,
  uint32_t fn, enum trx_chan_type chan,
  uint8_t bid, sbit_t *bits, uint16_t nbits,
- int8_t rssi, float toa);
+ int8_t rssi, int16_t toa256);
 
 struct trx_chan_desc {
/*! \brief Is this on a PDCH (PS) ? */
@@ -74,19 +74,19 @@
enum trx_chan_type chan, uint8_t bid, uint16_t *nbits);
 int rx_rach_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
-   int8_t rssi, float toa);
+   int8_t rssi, int16_t toa256);
 int rx_data_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
-   int8_t rssi, float toa);
+   int8_t rssi, int16_t toa256);
 int rx_pdtch_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
-   int8_t rssi, float toa);
+   int8_t rssi, int16_t toa256);
 int rx_tchf_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
-   int8_t rssi, float toa);
+   int8_t rssi, int16_t toa256);
 int rx_tchh_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
-   int8_t rssi, float toa);
+   int8_t rssi, int16_t toa256);
 
 const ubit_t *_sched_dl_burst(struct l1sched_trx *l1t, uint8_t tn,
  uint32_t fn, uint16_t *nbits);
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index e6cf541..edd99d2 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -846,7 +846,7 @@
 
 /* process uplink burst */
 int trx_sched_ul_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t 
current_fn,
-   sbit_t *bits, uint16_t nbits, int8_t rssi, float toa)
+   sbit_t *bits, uint16_t nbits, int8_t rssi, 

osmo-bts[master]: trx/scheduler: Use integer math for TOA (Timing of Arrival)

2018-02-27 Thread Harald Welte

Patch Set 3: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[PATCH] osmo-bts[master]: trx/scheduler: Use integer math for TOA (Timing of Arrival)

2018-02-27 Thread Harald Welte
Hello Vadim Yanitskiy, Jenkins Builder,

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

https://gerrit.osmocom.org/6955

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

trx/scheduler: Use integer math for TOA (Timing of Arrival)

There's no need to express TOA as a float:
* We receive it as signed 16bit integer in units 1/256 symbol periods
* We pass it to L1SAP as signed integer in 1/4 symbol periods

So turn it into an int16_t with 1/256 symbol period accuracy throughout
the code to avoid both float arithmetic as well as loosing any precision.

Change-Id: Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec
---
M include/osmo-bts/scheduler.h
M include/osmo-bts/scheduler_backend.h
M src/common/scheduler.c
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-trx/l1_if.h
M src/osmo-bts-trx/loops.c
M src/osmo-bts-trx/loops.h
M src/osmo-bts-trx/scheduler_trx.c
M src/osmo-bts-trx/trx_if.c
M src/osmo-bts-virtual/scheduler_virtbts.c
10 files changed, 74 insertions(+), 71 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/55/6955/3

diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 4d34315..98f38d3 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -75,7 +75,7 @@
uint8_t rssi_num;   /* number of RSSI values */
float   rssi_sum;   /* sum of RSSI values */
uint8_t toa_num;/* number of TOA values */
-   float   toa_sum;/* sum of TOA values */
+   int32_t toa256_sum; /* sum of TOA values (1/256 
symbol) */
 
/* loss detection */
uint8_t lost;   /* (SACCH) loss detection */
@@ -113,7 +113,7 @@
int rssi_count; /* received RSSI values */
int rssi_valid_count; /* number of stored value */
int rssi_got_burst; /* any burst received so far */
-   float   toa_sum;/* sum of TOA values */
+   int32_t toa256_sum; /* sum of TOA values (1/256 
symbol) */
int toa_num;/* number of TOA value */
} meas;
 
@@ -165,7 +165,7 @@
 
 /*! \brief handle an UL burst received by PHY */
 int trx_sched_ul_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
-sbit_t *bits, uint16_t nbits, int8_t rssi, float toa);
+sbit_t *bits, uint16_t nbits, int8_t rssi, int16_t toa);
 
 /*! \brief set multiframe scheduler to given physical channel config */
 int trx_sched_set_pchan(struct l1sched_trx *l1t, uint8_t tn,
diff --git a/include/osmo-bts/scheduler_backend.h 
b/include/osmo-bts/scheduler_backend.h
index 5e077ef..5f11f9b 100644
--- a/include/osmo-bts/scheduler_backend.h
+++ b/include/osmo-bts/scheduler_backend.h
@@ -16,7 +16,7 @@
 typedef int trx_sched_ul_func(struct l1sched_trx *l1t, uint8_t tn,
  uint32_t fn, enum trx_chan_type chan,
  uint8_t bid, sbit_t *bits, uint16_t nbits,
- int8_t rssi, float toa);
+ int8_t rssi, int16_t toa256);
 
 struct trx_chan_desc {
/*! \brief Is this on a PDCH (PS) ? */
@@ -74,19 +74,19 @@
enum trx_chan_type chan, uint8_t bid, uint16_t *nbits);
 int rx_rach_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
-   int8_t rssi, float toa);
+   int8_t rssi, int16_t toa256);
 int rx_data_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
-   int8_t rssi, float toa);
+   int8_t rssi, int16_t toa256);
 int rx_pdtch_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
-   int8_t rssi, float toa);
+   int8_t rssi, int16_t toa256);
 int rx_tchf_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
-   int8_t rssi, float toa);
+   int8_t rssi, int16_t toa256);
 int rx_tchh_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
-   int8_t rssi, float toa);
+   int8_t rssi, int16_t toa256);
 
 const ubit_t *_sched_dl_burst(struct l1sched_trx *l1t, uint8_t tn,
  uint32_t fn, uint16_t *nbits);
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index e6cf541..edd99d2 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -846,7 +846,7 @@
 
 /* process uplink burst */
 int trx_sched_ul_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t 
current_fn,
-   sbit_t *bits, uint16_t nbits, int8_t rssi, float toa)
+   sbit_t *bits, uint16_t nbits, int8_t rssi, int16_t toa256)
 {
struct l1sched_ts *l1ts = 

[PATCH] osmo-bts[master]: Add high-accuracy ToA value to Uplink Measurement Reports

2018-02-27 Thread Harald Welte

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

Add high-accuracy ToA value to Uplink Measurement Reports

Normal Abis RSL MEasurement Results contain only the "MS Timing Offset
IE" in units of full symbols.  In some use cases it is important to have
higher-accuracy timing information exposed to the BSC.

We do this by adding the average timing offset value during the last
measurement interval in 1/256th symbol accuracy to the "Supplementary
MEasuremen Information" part of the TS 48.058 9.3.25 Uplink Measurements
IE.

In order to avoid any compatibility issues, this feature is only enabled
if the new vty config command "supp-meas-info toa256" at the bts node
is enabled.

Change-Id: Ie85e53b47d4041cc4e6d7b78406ae8b79b2d9397
---
M include/osmo-bts/gsm_data_shared.h
M src/common/rsl.c
M src/common/vty.c
3 files changed, 41 insertions(+), 0 deletions(-)


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

diff --git a/include/osmo-bts/gsm_data_shared.h 
b/include/osmo-bts/gsm_data_shared.h
index 2d6ead1..2c21865 100644
--- a/include/osmo-bts/gsm_data_shared.h
+++ b/include/osmo-bts/gsm_data_shared.h
@@ -818,6 +818,7 @@
int bcch_change_mark;
 
struct rate_ctr_group *ctrs;
+   bool supp_meas_toa256;
 
void *role;
 };
diff --git a/src/common/rsl.c b/src/common/rsl.c
index 5c266ba..98e8913 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -2400,6 +2400,7 @@
uint8_t meas_res[16];
uint8_t chan_nr = gsm_lchan2chan_nr(lchan);
int res_valid = lchan->meas.flags & LC_UL_M_F_RES_VALID;
+   struct gsm_bts *bts = lchan->ts->trx->bts;
 
LOGP(DRSL, LOGL_DEBUG,
 "%s chan_num:%u Tx MEAS RES valid(%d), flags(%02x)\n",
@@ -2429,6 +2430,17 @@
meas_res);
lchan->tch.dtx.dl_active = false;
if (ie_len >= 3) {
+   if (bts->supp_meas_toa256) {
+   /* append signed 16bit value containing MS timing 
offset in 1/256th symbols
+* in the vendor-specific "Supplementary Measurement 
Information" part of
+* the uplink measurements IE.  This is the current 
offset *relative* to the
+* TA which the MS has already applied.  So if you want 
to know the total
+* propagation time between MS and BTS, you need to add 
the actual TA value
+* used (from L1_INFO below, in full symbols) plus the 
ms_toa256 value
+* in 1/256 symbol periods. */
+   meas_res[ie_len++] = lchan->meas.ms_toa256 >> 8;
+   meas_res[ie_len++] = lchan->meas.ms_toa256 & 0xff;
+   }
msgb_tlv_put(msg, RSL_IE_UPLINK_MEAS, ie_len, meas_res);
lchan->meas.flags &= ~LC_UL_M_F_RES_VALID;
}
diff --git a/src/common/vty.c b/src/common/vty.c
index 3938de5..b57e019 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -295,6 +295,8 @@
VTY_NEWLINE);
if (strcmp(btsb->pcu.sock_path, PCU_SOCK_DEFAULT))
vty_out(vty, " pcu-socket %s%s", btsb->pcu.sock_path, 
VTY_NEWLINE);
+   if (bts->supp_meas_toa256)
+   vty_out(vty, " supp-meas-info toa256%s", VTY_NEWLINE);
 
bts_model_config_write_bts(vty, bts);
 
@@ -621,6 +623,30 @@
btsb->pcu.sock_path = talloc_strdup(btsb, argv[0]);
/* FIXME: re-open the interface? */
 
+   return CMD_SUCCESS;
+}
+
+DEFUN(cfg_bts_supp_meas_toa256, cfg_bts_supp_meas_toa256_cmd,
+   "supp-meas-info toa256",
+   "Configure the RSL Supplementary Measurement Info\n"
+   "Report the TOA in 1/256th symbol periods\n")
+{
+   struct gsm_bts *bts = vty->index;
+   struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
+
+   bts->supp_meas_toa256 = true;
+   return CMD_SUCCESS;
+}
+
+DEFUN(cfg_bts_no_supp_meas_toa256, cfg_bts_no_supp_meas_toa256_cmd,
+   "no supp-meas-info toa256",
+   NO_STR "Configure the RSL Supplementary Measurement Info\n"
+   "Report the TOA in 1/256th symbol periods\n")
+{
+   struct gsm_bts *bts = vty->index;
+   struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
+
+   bts->supp_meas_toa256 = false;
return CMD_SUCCESS;
 }
 
@@ -1559,6 +1585,8 @@
install_element(BTS_NODE, _bts_min_qual_norm_cmd);
install_element(BTS_NODE, _bts_max_ber_rach_cmd);
install_element(BTS_NODE, _bts_pcu_sock_cmd);
+   install_element(BTS_NODE, _bts_supp_meas_toa256_cmd);
+   install_element(BTS_NODE, _bts_no_supp_meas_toa256_cmd);
 
install_element(BTS_NODE, _trx_gsmtap_sapi_cmd);
install_element(BTS_NODE, _trx_no_gsmtap_sapi_cmd);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie85e53b47d4041cc4e6d7b78406ae8b79b2d9397
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts

[PATCH] osmo-bts[master]: measurement: Keep average of high-accurate ToA value in lchan

2018-02-27 Thread Harald Welte

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

measurement: Keep average of high-accurate ToA value in lchan

At the end of a measurement processing window, we currently compute
the ToA / timing offset at 1/256th symbol accuracy, but we only print
it to the log.  Let's store the value in the lchan to make it usable
by other code in follow-up patches.

Change-Id: I5f00a16ac966b627d9452a98b8fa70984bed684a
---
M include/osmo-bts/gsm_data_shared.h
M src/common/measurement.c
2 files changed, 2 insertions(+), 0 deletions(-)


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

diff --git a/include/osmo-bts/gsm_data_shared.h 
b/include/osmo-bts/gsm_data_shared.h
index 770aea8..2d6ead1 100644
--- a/include/osmo-bts/gsm_data_shared.h
+++ b/include/osmo-bts/gsm_data_shared.h
@@ -290,6 +290,7 @@
/* last L1 header from the MS */
uint8_t l1_info[2];
struct gsm_meas_rep_unidir ul_res;
+   int16_t ms_toa256;
} meas;
struct {
struct amr_multirate_conf amr_mr;
diff --git a/src/common/measurement.c b/src/common/measurement.c
index bdb2850..ba7494a 100644
--- a/src/common/measurement.c
+++ b/src/common/measurement.c
@@ -399,6 +399,7 @@
mru->sub.rx_lev = dbm2rxlev((int)irssi_sub_sum * -1);
mru->full.rx_qual = ber10k_to_rxqual(ber_full_sum);
mru->sub.rx_qual = ber10k_to_rxqual(ber_sub_sum);
+   lchan->meas.ms_toa256 = ta256b_sum;
 
LOGP(DMEAS, LOGL_INFO, "%s UL MEAS RXLEV_FULL(%u), RXLEV_SUB(%u),"
   "RXQUAL_FULL(%u), RXQUAL_SUB(%u), num_meas_sub(%u), 
num_ul_meas(%u) \n",

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

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


[PATCH] osmo-bts[master]: measurement.c: higher-precision TA/TOA math

2018-02-27 Thread Harald Welte
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6965

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

measurement.c: higher-precision TA/TOA math

Change-Id: I0dc8e78545465dfc5c93691a49b86b6b8b56b432
---
M include/osmo-bts/gsm_data_shared.h
M src/common/l1sap.c
M src/common/measurement.c
3 files changed, 8 insertions(+), 8 deletions(-)


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

diff --git a/include/osmo-bts/gsm_data_shared.h 
b/include/osmo-bts/gsm_data_shared.h
index 7cefb10..770aea8 100644
--- a/include/osmo-bts/gsm_data_shared.h
+++ b/include/osmo-bts/gsm_data_shared.h
@@ -165,8 +165,8 @@
 struct bts_ul_meas {
/* BER in units of 0.01%: 10.000 == 100% ber, 0 == 0% ber */
uint16_t ber10k;
-   /* timing advance offset (in quarter bits) */
-   int16_t ta_offs_qbits;
+   /* timing advance offset (in 1/256 bits) */
+   int16_t ta_offs_256bits;
/* C/I ratio in dB */
float c_i;
/* flags */
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 50bd612..e095417 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -522,7 +522,7 @@
return 0;
 
memset(, 0, sizeof(ulm));
-   ulm.ta_offs_qbits = info_meas_ind->ta_offs_qbits;
+   ulm.ta_offs_256bits = info_meas_ind->ta_offs_qbits*(256/4);
ulm.ber10k = info_meas_ind->ber10k;
ulm.inv_rssi = info_meas_ind->inv_rssi;
ulm.is_sub = info_meas_ind->is_sub;
diff --git a/src/common/measurement.c b/src/common/measurement.c
index 98d9403..bdb2850 100644
--- a/src/common/measurement.c
+++ b/src/common/measurement.c
@@ -342,7 +342,7 @@
uint32_t irssi_full_sum = 0;
uint32_t ber_sub_sum = 0;
uint32_t irssi_sub_sum = 0;
-   int32_t taqb_sum = 0;
+   int32_t ta256b_sum = 0;
unsigned int num_meas_sub = 0;
int i;
 
@@ -362,7 +362,7 @@
 
ber_full_sum += m->ber10k;
irssi_full_sum += m->inv_rssi;
-   taqb_sum += m->ta_offs_qbits;
+   ta256b_sum += m->ta_offs_256bits;
 
if (m->is_sub) {
num_meas_sub++;
@@ -374,7 +374,7 @@
/* step 2: divide */
ber_full_sum = ber_full_sum / lchan->meas.num_ul_meas;
irssi_full_sum = irssi_full_sum / lchan->meas.num_ul_meas;
-   taqb_sum = taqb_sum / lchan->meas.num_ul_meas;
+   ta256b_sum = ta256b_sum / lchan->meas.num_ul_meas;
 
if (num_meas_sub) {
ber_sub_sum = ber_sub_sum / num_meas_sub;
@@ -387,9 +387,9 @@
irssi_sub_sum = 120; /* -120 dBm */
}
 
-   LOGP(DMEAS, LOGL_INFO, "%s Computed TA(% 4dqb) BER-FULL(%2u.%02u%%), 
RSSI-FULL(-%3udBm), "
+   LOGP(DMEAS, LOGL_INFO, "%s Computed TA256(% 4d) BER-FULL(%2u.%02u%%), 
RSSI-FULL(-%3udBm), "
"BER-SUB(%2u.%02u%%), RSSI-SUB(-%3udBm)\n", 
gsm_lchan_name(lchan),
-   taqb_sum, ber_full_sum/100,
+   ta256b_sum, ber_full_sum/100,
ber_full_sum%100, irssi_full_sum, ber_sub_sum/100, 
ber_sub_sum%100,
irssi_sub_sum);
 

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I0dc8e78545465dfc5c93691a49b86b6b8b56b432
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[PATCH] libosmocore[master]: core/logging.h: Add logging category for jitter buffer

2018-02-27 Thread Pau Espin Pedrol
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6969

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

core/logging.h: Add logging category for jitter buffer

Forthcoming jitter buffer code in libosmo-netif will make use of it.

Change-Id: I2434f9dfa401f736bc62a2ddce920e587cd8c517
---
M include/osmocom/core/logging.h
M src/logging.c
2 files changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/69/6969/2

diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h
index 617d78e..e68f618 100644
--- a/include/osmocom/core/logging.h
+++ b/include/osmocom/core/logging.h
@@ -121,7 +121,8 @@
 #define DLSUA  -15 /*!< Osmocom SUA */
 #define DLM3UA -16 /*!< Osmocom M3UA */
 #define DLMGCP -17 /*!< Osmocom MGCP */
-#define OSMO_NUM_DLIB  17  /*!< Number of logging sub-systems in libraries 
*/
+#define DLJIBUF-18 /*!< Osmocom Jitter Buffer */
+#define OSMO_NUM_DLIB  18  /*!< Number of logging sub-systems in libraries 
*/
 
 /*! Configuration of single log category / sub-system */
 struct log_category {
diff --git a/src/logging.c b/src/logging.c
index 66074ea..147b1fb 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -168,6 +168,11 @@
.description = "libosmo-mgcp Media Gateway Control Protocol",
.enabled = 1, .loglevel = LOGL_NOTICE,
},
+   [INT2IDX(DLJIBUF)] = {
+   .name = "DLJIBUF",
+   .description = "libosmo-netif Jitter Buffer",
+   .enabled = 1, .loglevel = LOGL_NOTICE,
+   },
 };
 
 /*! descriptive string for each log level */

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I2434f9dfa401f736bc62a2ddce920e587cd8c517
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder


osmo-bts[master]: trx/scheduler: Use integer math for TOA (Timing of Arrival)

2018-02-27 Thread Vadim Yanitskiy

Patch Set 2: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[PATCH] libosmocore[master]: support for more cell ID list types in libosmocore

2018-02-27 Thread Stefan Sperling
Hello Neels Hofmeyr, Jenkins Builder,

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

https://gerrit.osmocom.org/6509

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

support for more cell ID list types in libosmocore

Introduce gsm0808_dec_cell_id_list2() with supports additional types of
cell identifier lists. The new parsing routines are based on similar
routines used by the paging code in osmo-bsc's osmo_bsc_bssap.c.

Likewise, introduce gsm0808_enc_cell_id_list2() with support for the
same additional types of cell identifier lists.

The old API using struct gsm0808_cell_id_list is deprecated.
The previous definition was insufficient because it assumed that all
decoded cell ID types could be represented with a single uint16_t.
It was declared in a GSM protocol header (gsm/protocol/gsm_08_08.h)
despite being a host-side representation of data in an IE.
The only user I am aware of is in osmo-msc, where this struct is used
for one local variable. osmo-msc releases >= 1.1.0 make use of this API.

Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb
Related: OS#2847
---
M include/osmocom/gsm/gsm0808.h
M include/osmocom/gsm/gsm0808_utils.h
M include/osmocom/gsm/gsm23003.h
M include/osmocom/gsm/protocol/gsm_08_08.h
M src/gsm/gsm0808.c
M src/gsm/gsm0808_utils.c
M src/gsm/libosmogsm.map
M tests/gsm0808/gsm0808_test.c
8 files changed, 354 insertions(+), 31 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/09/6509/9

diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h
index 3deee70..62ff06e 100644
--- a/include/osmocom/gsm/gsm0808.h
+++ b/include/osmocom/gsm/gsm0808.h
@@ -28,6 +28,8 @@
 struct sockaddr_storage;
 
 struct msgb;
+struct gsm0808_cell_id_list;
+struct gsm0808_cell_id_list2;
 
 struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc,
   uint16_t cc, int lac, uint16_t _ci);
@@ -66,6 +68,10 @@
 *scl);
 struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t 
*rr_cause);
 struct msgb *gsm0808_create_clear_rqst(uint8_t cause);
+struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi,
+  const struct gsm0808_cell_id_list2 *cil,
+  const uint8_t *chan_needed);
+/* deprecated */
 struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi,
   const struct gsm0808_cell_id_list *cil,
   const uint8_t *chan_needed);
diff --git a/include/osmocom/gsm/gsm0808_utils.h 
b/include/osmocom/gsm/gsm0808_utils.h
index 7432164..61f980e 100644
--- a/include/osmocom/gsm/gsm0808_utils.h
+++ b/include/osmocom/gsm/gsm0808_utils.h
@@ -26,6 +26,27 @@
 struct sockaddr_storage;
 
 #include 
+#include 
+
+/*! Maximum number of elements in a cell identifier list. */
+#define GSM0808_CELL_ID_LIST2_MAXLEN   128
+
+/*! Parsed representation of a cell identifier list IE. */
+struct gsm0808_cell_id_list2 {
+   enum CELL_IDENT id_discr;
+   union {
+   /*!
+* All elements of these arrays contain parsed representations 
of the
+* data in the corresponding IE, in host-byte order.
+*/
+   struct osmo_cell_global_id  
id_list_global[GSM0808_CELL_ID_LIST2_MAXLEN];
+   struct osmo_lac_and_ci_id   
id_list_lac_and_ci[GSM0808_CELL_ID_LIST2_MAXLEN];
+   uint16_t
id_list_ci[GSM0808_CELL_ID_LIST2_MAXLEN];
+   struct osmo_location_area_id
id_list_lai_and_lac[GSM0808_CELL_ID_LIST2_MAXLEN];
+   uint16_t
id_list_lac[GSM0808_CELL_ID_LIST2_MAXLEN];
+   } id_list;
+   unsigned int id_list_len;
+};
 
 uint8_t gsm0808_enc_aoip_trasp_addr(struct msgb *msg,
const struct sockaddr_storage *ss);
@@ -48,8 +69,12 @@
 const struct gsm0808_encrypt_info *ei);
 int gsm0808_dec_encrypt_info(struct gsm0808_encrypt_info *ei,
 const uint8_t *elem, uint8_t len);
+uint8_t gsm0808_enc_cell_id_list2(struct msgb *msg, const struct 
gsm0808_cell_id_list2 *cil);
+/* deprecated */
 uint8_t gsm0808_enc_cell_id_list(struct msgb *msg,
 const struct gsm0808_cell_id_list *cil);
+int gsm0808_dec_cell_id_list2(struct gsm0808_cell_id_list2 *cil, const uint8_t 
*elem, uint8_t len);
+/* deprecated */
 int gsm0808_dec_cell_id_list(struct gsm0808_cell_id_list *cil,
 const uint8_t *elem, uint8_t len);
 int gsm0808_chan_type_to_speech_codec(uint8_t perm_spch);
diff --git a/include/osmocom/gsm/gsm23003.h b/include/osmocom/gsm/gsm23003.h
index dd41bc5..9623a05 100644
--- a/include/osmocom/gsm/gsm23003.h
+++ b/include/osmocom/gsm/gsm23003.h
@@ -29,6 +29,13 @@
uint16_t cell_identity;
 };
 
+/* 

[MERGED] osmo-bts[master]: Move rach_busy counting above L1SAP

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Move rach_busy counting above L1SAP
..


Move rach_busy counting above L1SAP

In the past, rach_busy counting was performed below L1SAP, while
reporting was handled above.  This lead to subtle differences between
the BTS models, such as osmo-bts-trx missing to increment rach_busy.

Let's move the rach_busy counting above L1SAP to share more code.

This means we need libosmocore Change-Id
I9439810c3a3ad89ea0302753617b850749af887c for the additional required
parameters in ph_rach_ind_param, as well as libosmocore Change-id
I2b1926a37bde860dcfeb0d613eb55a71271928c5 for osmo-bts-trx to determine
the RACH bit error rate.

Change-Id: I3b989580cb38082e3fd8fc50a11fedda13991092
Closes: OS#3003
---
M src/common/l1sap.c
M src/osmo-bts-litecell15/l1_if.c
M src/osmo-bts-octphy/l1_if.c
M src/osmo-bts-sysmo/l1_if.c
M src/osmo-bts-trx/scheduler_trx.c
5 files changed, 44 insertions(+), 48 deletions(-)

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



diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 2623d84..90f045a 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1190,7 +1190,23 @@
uint8_t acc_delay;
 
DEBUGPFN(DL1P, rach_ind->fn, "Rx PH-RA.ind");
+
+   /* check for handover access burst on dedicated channels */
+   if (!L1SAP_IS_CHAN_RACH(rach_ind->chan_nr)) {
+   rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_RACH_HO);
+   return l1sap_handover_rach(trx, l1sap, rach_ind);
+   }
+
rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_RACH_RCVD);
+
+   /* increment number of busy RACH slots, if required */
+   if (rach_ind->rssi >= btsb->load.rach.busy_thresh)
+   btsb->load.rach.busy++;
+
+   /* FIXME: RACH filtering due to BER limit */
+
+   /* increment number of RACH slots with valid non-handover RACH burst */
+   btsb->load.rach.access++;
 
lc = >ts[0].lchan[CCCH_LCHAN].lapdm_ch;
 
@@ -1204,12 +1220,6 @@
 
/* According to 3GPP TS 48.058 § 9.3.17 Access Delay is expressed same 
way as TA (number of symbols) */
set_ms_to_data(get_lchan_by_chan_nr(trx, rach_ind->chan_nr), acc_delay, 
false);
-
-   /* check for handover rach */
-   if (!L1SAP_IS_CHAN_RACH(rach_ind->chan_nr)) {
-   rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_RACH_HO);
-   return l1sap_handover_rach(trx, l1sap, rach_ind);
-   }
 
/* check for packet access */
if ((trx == bts->c0 && L1SAP_IS_PACKET_RACH(rach_ind->ra)) ||
diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index 9c3b867..1b83fbd 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -1002,23 +1002,15 @@
uint16_t ra = 0, is_11bit = 0, burst_type = 0, temp = 0;
int rc;
 
-   /* increment number of busy RACH slots, if required */
-   if (trx == bts->c0 &&
-   ra_ind->measParam.fRssi >= btsb->load.rach.busy_thresh)
-   btsb->load.rach.busy++;
-
+   /* FIXME: this should be deprecated/obsoleted as it bypasses rach.busy 
counting */
if (ra_ind->measParam.fLinkQuality < btsb->min_qual_rach) {
msgb_free(l1p_msg);
return 0;
}
 
+   /* the old legacy full-bits acc_delay cannot express negative values */
if (ra_ind->measParam.i16BurstTiming > 0)
acc_delay = ra_ind->measParam.i16BurstTiming >> 2;
-
-   /* increment number of RACH slots with valid non-handover RACH burst */
-   lchan = l1if_hLayer_to_lchan(trx, (uint32_t)ra_ind->hLayer2);
-   if (trx == bts->c0 && !(lchan && lchan->ho.active == HANDOVER_ENABLED))
-   btsb->load.rach.access++;
 
dump_meas_res(LOGL_DEBUG, _ind->measParam);
burst_type = ra_ind->burstType;
@@ -1052,6 +1044,9 @@
l1sap->u.rach_ind.acc_delay = acc_delay;
l1sap->u.rach_ind.fn = fn;
l1sap->u.rach_ind.is_11bit = is_11bit; /* no of bits in 11 bit RACH */
+   l1sap->u.rach_ind.rssi = (int8_t) ra_ind->measParam.fRssi;
+   l1sap->u.rach_ind.ber10k = (unsigned int) (ra_ind->measParam.fBer * 
1.0);
+   l1sap->u.rach_ind.acc_delay_256bits = ra_ind->measParam.i16BurstTiming 
* 64;
 
/* mapping of the burst type, the values are specific to
 * osmo-bts-litecell15 */
@@ -1074,6 +1069,7 @@
break;
}
 
+   lchan = l1if_hLayer_to_lchan(trx, (uint32_t)ra_ind->hLayer2);
if (!lchan || lchan->ts->pchan == GSM_PCHAN_CCCH ||
lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4 ||
lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH)
diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index ddaa9b3..535ac8b 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -1167,30 +1167,17 @@
struct gsm_bts_trx *trx = 

osmo-bts[master]: trx/scheduler: Use integer math for TOA (Timing of Arrival)

2018-02-27 Thread Harald Welte

Patch Set 2:

(3 comments)

https://gerrit.osmocom.org/#/c/6955/2/src/osmo-bts-trx/scheduler_trx.c
File src/osmo-bts-trx/scheduler_trx.c:

Line 745:   toa *= 10;
> Should this part also be updated?
I thikn it can be removed.  For my patch, I will change it to toa256 *= 10 to 
not mix the two unrelated issues of changing float->int and the removal of this 
debugging (which can now be done much better with fake-trx.


Line 1060:  n_errors, n_bits_total, rssi, toa256);
> Just wondering, why don't we compute the AVG here?
you mean the average over all 4 bursts?  I have no idea why not. My patch 
simply changes float->int, and doesn't intend to change any logic. FEel free to 
create a patch or ticket for averaging.


https://gerrit.osmocom.org/#/c/6955/2/src/osmo-bts-trx/trx_if.c
File src/osmo-bts-trx/trx_if.c:

Line 523:   int16_t toa256 = 0;
> No need to init, it will be overwritten.
once again, I'm just changing the data type here and try to not make any other 
modifications.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: Yes


[MERGED] osmo-bts[master]: RACH decoding: Use BER threshold for RACH ghost detection

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: RACH decoding: Use BER threshold for RACH ghost detection
..


RACH decoding: Use BER threshold for RACH ghost detection

When decoding RACH bursts, we should use a BER threshold in order to
help distinguish 'ghost' RACH bursts from real RACH bursts.

The theoretical ideal threshold according to some papers is 7 out of 41
bits qhich aquals to Eb/N0 of 0 dB = 0.1707 (17.07%)

We add a new 'ber10k' parameter to the RACH indication l1sap primitive
(needs separate change for libosmocore), and then fill this value from
osmo-bts-{sysmo,lc15,trx,octphy}.  The common part above L1SAP then
applies the threshold, which can be changed from vty using the
"max-ber10k-rach <0-1>"
command available at the BTS node.  The unit is BER in 1/1, i.e. a
value of 100 equals 1% bit error rate.

Change-Id: Ic41c11f6312a36baa2738547e8dcec80829457f8
---
M include/osmo-bts/gsm_data.h
M src/common/bts.c
M src/common/l1sap.c
M src/common/vty.c
4 files changed, 24 insertions(+), 1 deletion(-)

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



diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index f2574b1..10c9d04 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -111,6 +111,7 @@
 
float min_qual_rach;/* minimum quality for RACH bursts */
float min_qual_norm;/* minimum quality for normal daata */
+   uint16_t max_ber10k_rach;   /* Maximum permitted RACH BER in 0.01% 
*/
 
struct {
char *sock_path;
diff --git a/src/common/bts.c b/src/common/bts.c
index b10d7f2..15b92d7 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -149,6 +149,7 @@
btsb->t3105_ms = 300;
btsb->min_qual_rach = MIN_QUAL_RACH;
btsb->min_qual_norm = MIN_QUAL_NORM;
+   btsb->max_ber10k_rach = 1707; /* 7 of 41 bits is Eb/N0 of 0 dB = 0.1707 
*/
btsb->pcu.sock_path = talloc_strdup(btsb, PCU_SOCK_DEFAULT);
for (i = 0; i < ARRAY_SIZE(btsb->t200_ms); i++)
btsb->t200_ms[i] = oml_default_t200_ms[i];
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 90f045a..50bd612 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1203,7 +1203,12 @@
if (rach_ind->rssi >= btsb->load.rach.busy_thresh)
btsb->load.rach.busy++;
 
-   /* FIXME: RACH filtering due to BER limit */
+   /* check for RACH exceeding BER threshold (ghost RACH) */
+   if (rach_ind->ber10k > btsb->max_ber10k_rach) {
+   DEBUGPFN(DL1C, rach_ind->fn, "ignoring RACH request: %u > %u 
(max BER)\n",
+   rach_ind->ber10k, btsb->max_ber10k_rach);
+   return 0;
+   }
 
/* increment number of RACH slots with valid non-handover RACH burst */
btsb->load.rach.access++;
diff --git a/src/common/vty.c b/src/common/vty.c
index a1cb2fe..3938de5 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -291,6 +291,8 @@
VTY_NEWLINE);
vty_out(vty, " min-qual-norm %.0f%s", btsb->min_qual_norm * 10.0f,
VTY_NEWLINE);
+   vty_out(vty, " max-ber10k-rach %u%s", btsb->max_ber10k_rach,
+   VTY_NEWLINE);
if (strcmp(btsb->pcu.sock_path, PCU_SOCK_DEFAULT))
vty_out(vty, " pcu-socket %s%s", btsb->pcu.sock_path, 
VTY_NEWLINE);
 
@@ -588,6 +590,19 @@
struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
 
btsb->min_qual_norm = strtof(argv[0], NULL) / 10.0f;
+
+   return CMD_SUCCESS;
+}
+
+DEFUN(cfg_bts_max_ber_rach, cfg_bts_max_ber_rach_cmd,
+   "max-ber10k-rach <0-1>",
+   "Set the maximum BER for valid RACH requests\n"
+   "BER in 1/1 units (0=no BER; 100=1% BER)\n")
+{
+   struct gsm_bts *bts = vty->index;
+   struct gsm_bts_role_bts *btsb = bts_role_bts(bts);
+
+   btsb->max_ber10k_rach = strtoul(argv[0], NULL, 10);
 
return CMD_SUCCESS;
 }
@@ -1542,6 +1557,7 @@
install_element(BTS_NODE, _bts_ul_power_target_cmd);
install_element(BTS_NODE, _bts_min_qual_rach_cmd);
install_element(BTS_NODE, _bts_min_qual_norm_cmd);
+   install_element(BTS_NODE, _bts_max_ber_rach_cmd);
install_element(BTS_NODE, _bts_pcu_sock_cmd);
 
install_element(BTS_NODE, _trx_gsmtap_sapi_cmd);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic41c11f6312a36baa2738547e8dcec80829457f8
Gerrit-PatchSet: 4
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 


[PATCH] libosmocore[master]: support for more cell ID list types in libosmocore

2018-02-27 Thread Stefan Sperling
Hello Neels Hofmeyr, Jenkins Builder,

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

https://gerrit.osmocom.org/6509

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

support for more cell ID list types in libosmocore

Extend gsm0808_dec_cell_id_list() with support for additional types of
cell identifier lists. The new parsing routines are based on similar
routines used by the paging code in osmo-bsc's osmo_bsc_bssap.c.

Likewise, extend gsm0808_enc_cell_id_list() with support for the
same additional types of cell identifier lists.

There is an API change in struct gsm0808_cell_id_list.
The previous definition was insufficient because it assumed that all
decoded cell ID types could be represented with a single uint16_t.
It was declared in a GSM protocol header (gsm/protocol/gsm_08_08.h)
despite being a host-side representation of data in an IE.
The only user I am aware of is in osmo-msc, where this struct is used
for one local variable.
This API user is fixed by https://gerrit.osmocom.org/#/c/6518/

Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb
Related: OS#2847
---
M include/osmocom/gsm/gsm0808.h
M include/osmocom/gsm/gsm0808_utils.h
M include/osmocom/gsm/gsm23003.h
M include/osmocom/gsm/protocol/gsm_08_08.h
M src/gsm/gsm0808.c
M src/gsm/gsm0808_utils.c
M src/gsm/libosmogsm.map
M tests/gsm0808/gsm0808_test.c
8 files changed, 354 insertions(+), 31 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/09/6509/7

diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h
index 3deee70..62ff06e 100644
--- a/include/osmocom/gsm/gsm0808.h
+++ b/include/osmocom/gsm/gsm0808.h
@@ -28,6 +28,8 @@
 struct sockaddr_storage;
 
 struct msgb;
+struct gsm0808_cell_id_list;
+struct gsm0808_cell_id_list2;
 
 struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc,
   uint16_t cc, int lac, uint16_t _ci);
@@ -66,6 +68,10 @@
 *scl);
 struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t 
*rr_cause);
 struct msgb *gsm0808_create_clear_rqst(uint8_t cause);
+struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi,
+  const struct gsm0808_cell_id_list2 *cil,
+  const uint8_t *chan_needed);
+/* deprecated */
 struct msgb *gsm0808_create_paging(const char *imsi, const uint32_t *tmsi,
   const struct gsm0808_cell_id_list *cil,
   const uint8_t *chan_needed);
diff --git a/include/osmocom/gsm/gsm0808_utils.h 
b/include/osmocom/gsm/gsm0808_utils.h
index 7432164..61f980e 100644
--- a/include/osmocom/gsm/gsm0808_utils.h
+++ b/include/osmocom/gsm/gsm0808_utils.h
@@ -26,6 +26,27 @@
 struct sockaddr_storage;
 
 #include 
+#include 
+
+/*! Maximum number of elements in a cell identifier list. */
+#define GSM0808_CELL_ID_LIST2_MAXLEN   128
+
+/*! Parsed representation of a cell identifier list IE. */
+struct gsm0808_cell_id_list2 {
+   enum CELL_IDENT id_discr;
+   union {
+   /*!
+* All elements of these arrays contain parsed representations 
of the
+* data in the corresponding IE, in host-byte order.
+*/
+   struct osmo_cell_global_id  
id_list_global[GSM0808_CELL_ID_LIST2_MAXLEN];
+   struct osmo_lac_and_ci_id   
id_list_lac_and_ci[GSM0808_CELL_ID_LIST2_MAXLEN];
+   uint16_t
id_list_ci[GSM0808_CELL_ID_LIST2_MAXLEN];
+   struct osmo_location_area_id
id_list_lai_and_lac[GSM0808_CELL_ID_LIST2_MAXLEN];
+   uint16_t
id_list_lac[GSM0808_CELL_ID_LIST2_MAXLEN];
+   } id_list;
+   unsigned int id_list_len;
+};
 
 uint8_t gsm0808_enc_aoip_trasp_addr(struct msgb *msg,
const struct sockaddr_storage *ss);
@@ -48,8 +69,12 @@
 const struct gsm0808_encrypt_info *ei);
 int gsm0808_dec_encrypt_info(struct gsm0808_encrypt_info *ei,
 const uint8_t *elem, uint8_t len);
+uint8_t gsm0808_enc_cell_id_list2(struct msgb *msg, const struct 
gsm0808_cell_id_list2 *cil);
+/* deprecated */
 uint8_t gsm0808_enc_cell_id_list(struct msgb *msg,
 const struct gsm0808_cell_id_list *cil);
+int gsm0808_dec_cell_id_list2(struct gsm0808_cell_id_list2 *cil, const uint8_t 
*elem, uint8_t len);
+/* deprecated */
 int gsm0808_dec_cell_id_list(struct gsm0808_cell_id_list *cil,
 const uint8_t *elem, uint8_t len);
 int gsm0808_chan_type_to_speech_codec(uint8_t perm_spch);
diff --git a/include/osmocom/gsm/gsm23003.h b/include/osmocom/gsm/gsm23003.h
index dd41bc5..9623a05 100644
--- a/include/osmocom/gsm/gsm23003.h
+++ b/include/osmocom/gsm/gsm23003.h
@@ -29,6 +29,13 @@
uint16_t cell_identity;
 };
 
+/* 

libosmocore[master]: support for more cell ID list types in libosmocore

2018-02-27 Thread Stefan Sperling

Patch Set 7:

> Uploaded patch set 7.

This new patch set keeps the old API around (deprecated) and introduces a 
separate API which supports all types of cell identifier lists.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb
Gerrit-PatchSet: 7
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Stefan Sperling 
Gerrit-HasComments: No


[PATCH] libosmocore[master]: core/logging.h: Add logging category for jitter buffer

2018-02-27 Thread Pau Espin Pedrol

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

core/logging.h: Add logging category for jitter buffer

Forthcoming jitter buffer code in libosmo-netif will make use of it.

Change-Id: I2434f9dfa401f736bc62a2ddce920e587cd8c517
---
M include/osmocom/core/logging.h
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/69/6969/1

diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h
index 617d78e..e68f618 100644
--- a/include/osmocom/core/logging.h
+++ b/include/osmocom/core/logging.h
@@ -121,7 +121,8 @@
 #define DLSUA  -15 /*!< Osmocom SUA */
 #define DLM3UA -16 /*!< Osmocom M3UA */
 #define DLMGCP -17 /*!< Osmocom MGCP */
-#define OSMO_NUM_DLIB  17  /*!< Number of logging sub-systems in libraries 
*/
+#define DLJIBUF-18 /*!< Osmocom Jitter Buffer */
+#define OSMO_NUM_DLIB  18  /*!< Number of logging sub-systems in libraries 
*/
 
 /*! Configuration of single log category / sub-system */
 struct log_category {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2434f9dfa401f736bc62a2ddce920e587cd8c517
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 


osmo-bts[master]: RACH decoding: Use BER threshold for RACH ghost detection

2018-02-27 Thread Harald Welte

Patch Set 4: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic41c11f6312a36baa2738547e8dcec80829457f8
Gerrit-PatchSet: 4
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmo-bts[master]: Move rach_busy counting above L1SAP

2018-02-27 Thread Harald Welte

Patch Set 4: Code-Review+2

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

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


[PATCH] osmo-ttcn3-hacks[master]: BSC_Tests: try to avoid race condition

2018-02-27 Thread dexter

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

BSC_Tests: try to avoid race condition

When the test component ends and the underlaying
components are shut down. Messages from the system
under test may still be picked up and forwared. When
a message is handed from one component to one that
is already shut down, the testcase is flagged as
errornous setverdict(error).

An idea to fix thisis to stop all test ports using
all port.stop. However, this does not solve the
problem entirely. We still observing errors.

- add f_shutdown_helper() and call it from the
  end of each testcase

- perform an all port.stop; in f_shutdown_helper()
  to freeze all communications between the ports
  of the different components.

Change-Id: Id3bc840c0428d08dfbeedacc408b3dd1cd0fa7ec
---
M bsc/BSC_Tests.ttcn
1 file changed, 27 insertions(+), 1 deletion(-)


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

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index d94faad..8d397f7 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -107,6 +107,11 @@
};
 }
 
+private function f_shutdown_helper() runs on test_CT {
+   all port.stop;
+   setverdict(pass);
+}
+
 private function f_legacy_bssap_reset() runs on test_CT {
var BSSAP_N_UNITDATA_ind ud_ind;
timer T := 5.0;
@@ -1011,6 +1016,7 @@
var BSSMAP_FIELD_CellIdentificationList cid_list;
cid_list := valueof(ts_BSSMAP_CIL_noCell);
f_pageing_helper('00101010001'H, cid_list, c_BtsId_all, omit, omit);
+   f_shutdown_helper();
 }
 
 /* PAGING by IMSI + TMSI */
@@ -1018,6 +1024,7 @@
var BSSMAP_FIELD_CellIdentificationList cid_list;
cid_list := valueof(ts_BSSMAP_CIL_noCell);
f_pageing_helper('00101010001'H, cid_list, c_BtsId_all, omit, 
'A1B2C301'O);
+   f_shutdown_helper();
 }
 
 /* Paging with different "channel needed' values */
@@ -1025,21 +1032,25 @@
var BSSMAP_FIELD_CellIdentificationList cid_list;
cid_list := valueof(ts_BSSMAP_CIL_noCell);
f_pageing_helper('00101010002'H, cid_list, c_BtsId_all, 
RSL_CHANNEED_ANY, 'A1B2C302'O);
+   f_shutdown_helper();
 }
 testcase TC_paging_tmsi_sdcch() runs on test_CT {
var BSSMAP_FIELD_CellIdentificationList cid_list;
cid_list := valueof(ts_BSSMAP_CIL_noCell);
f_pageing_helper('00101010003'H, cid_list, c_BtsId_all, 
RSL_CHANNEED_SDCCH, 'A1B2C303'O);
+   f_shutdown_helper();
 }
 testcase TC_paging_tmsi_tch_f() runs on test_CT {
var BSSMAP_FIELD_CellIdentificationList cid_list;
cid_list := valueof(ts_BSSMAP_CIL_noCell);
f_pageing_helper('0010104'H, cid_list, c_BtsId_all, 
RSL_CHANNEED_TCH_F, 'A1B2C304'O);
+   f_shutdown_helper();
 }
 testcase TC_paging_tmsi_tch_hf() runs on test_CT {
var BSSMAP_FIELD_CellIdentificationList cid_list;
cid_list := valueof(ts_BSSMAP_CIL_noCell);
f_pageing_helper('0010105'H, cid_list, c_BtsId_all, 
RSL_CHANNEED_TCH_ForH, 'A1B2C305'O);
+   f_shutdown_helper();
 }
 
 /* Paging by CGI */
@@ -1047,6 +1058,7 @@
var template BSSMAP_FIELD_CellIdentificationList cid_list;
cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(cid.mcc, cid.mnc, cid.lac, 
cid.ci) } };
f_pageing_helper('0010106'H, cid_list, { 0 });
+   f_shutdown_helper();
 }
 
 /* Paging by LAC+CI */
@@ -1054,6 +1066,7 @@
var template BSSMAP_FIELD_CellIdentificationList cid_list;
cid_list := { cIl_LAC_CI := { ts_BSSMAP_CI_LAC_CI(cid.lac, cid.ci) } };
f_pageing_helper('0010107'H, cid_list, { 0 });
+   f_shutdown_helper();
 }
 
 /* Paging by CI */
@@ -1061,6 +1074,7 @@
var template BSSMAP_FIELD_CellIdentificationList cid_list;
cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } };
f_pageing_helper('0010108'H, cid_list, { 0 });
+   f_shutdown_helper();
 }
 
 /* Paging by LAI */
@@ -1068,6 +1082,7 @@
var template BSSMAP_FIELD_CellIdentificationList cid_list;
cid_list := { cIl_LAI := { ts_BSSMAP_CI_LAI(cid.mcc, cid.mnc, cid.lac) 
} };
f_pageing_helper('0010109'H, cid_list, c_BtsId_LAC1);
+   f_shutdown_helper();
 }
 
 /* Paging by LAC */
@@ -1075,6 +1090,7 @@
var template BSSMAP_FIELD_CellIdentificationList cid_list;
cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } };
f_pageing_helper('0010110'H, cid_list, c_BtsId_LAC1);
+   f_shutdown_helper();
 }
 
 /* Paging by "all in BSS" */
@@ -1082,6 +1098,7 @@
var template BSSMAP_FIELD_CellIdentificationList cid_list;
cid_list := { cIl_allInBSS := ''O };
f_pageing_helper('0010111'H, cid_list, c_BtsId_all);
+   f_shutdown_helper();
 }
 
 /* Paging by PLMN+LAC+RNC */
@@ -1089,6 +1106,7 @@
var template BSSMAP_FIELD_CellIdentificationList cid_list;
cid_list := { cIl_PLMN_LAC_RNC := { ts_BSSMAP_CI_PLMN_LAC_RNC(cid.mcc, 
cid.mnc, cid.lac, 12) } 

osmo-bts[master]: trx/scheduler: Use integer math for TOA (Timing of Arrival)

2018-02-27 Thread Vadim Yanitskiy

Patch Set 2: -Code-Review

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmo-bts[master]: trx/scheduler: Use integer math for TOA (Timing of Arrival)

2018-02-27 Thread Vadim Yanitskiy

Patch Set 2: Code-Review+1

(3 comments)

The ToA computation logic looks a bit complicated in scheduler_trx.c.
Somewhere we calculate AVG, but for FACCH we don't. Somewhere we
multiply by 4, somewhere we divide by 256. Are you sure that
everything is correct?

I think it would be great to clarify and/or define macros
for such computations?

https://gerrit.osmocom.org/#/c/6955/2/src/osmo-bts-trx/scheduler_trx.c
File src/osmo-bts-trx/scheduler_trx.c:

Line 745:   toa *= 10;
Should this part also be updated?
And does anyone still use it?


Line 1060:  n_errors, n_bits_total, rssi, toa256);
Just wondering, why don't we compute the AVG here?


https://gerrit.osmocom.org/#/c/6955/2/src/osmo-bts-trx/trx_if.c
File src/osmo-bts-trx/trx_if.c:

Line 523:   int16_t toa256 = 0;
No need to init, it will be overwritten.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: Yes


osmo-bts[master]: RACH decoding: Use BER threshold for RACH ghost detection

2018-02-27 Thread Vadim Yanitskiy

Patch Set 4: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic41c11f6312a36baa2738547e8dcec80829457f8
Gerrit-PatchSet: 4
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


libosmocore[master]: support for more cell ID list types in libosmocore

2018-02-27 Thread Stefan Sperling

Patch Set 6:

> the question was who is *using* this API from any tagged/relesed
 > version.  Like: "Did we tag any osmobsc version that uses this
 > API".

Ah, right, that makes sense.

The answer would be: osmo-msc-1.1.0 and above.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb
Gerrit-PatchSet: 6
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Stefan Sperling 
Gerrit-HasComments: No


libosmocore[master]: support for more cell ID list types in libosmocore

2018-02-27 Thread Harald Welte

Patch Set 6:

the question was who is *using* this API from any tagged/relesed version.  
Like: "Did we tag any osmobsc version that uses this API".

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb
Gerrit-PatchSet: 6
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Stefan Sperling 
Gerrit-HasComments: No


libosmocore[master]: support for more cell ID list types in libosmocore

2018-02-27 Thread Stefan Sperling

Patch Set 6:

> > > Understood. Are we willing to make an exception and break the
 > API
 > > > in this case or not? When we spoke some days ago, my take-away
 > > was
 > > > that were were willing to make a breaking change in this
 > > particular
 > > > case.
 > >
 > > when was the API introduced? Which users are using it?  Are there
 > > any tagged releases of our software that would fail to build if
 > > this change was made?  This is what matters to the users.
 > 
 > The API was introduced in 
 > http://git.osmocom.org/libosmocore/commit/?id=783047e86ec64677f3894bd22576315eee631275
 > which is contained in the libosmocore-0.10.0 tag.
 > 
 > I suppose this means we should keep the API?

The only known user is, as stated before, osmo-msc.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb
Gerrit-PatchSet: 6
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Stefan Sperling 
Gerrit-HasComments: No


libosmocore[master]: support for more cell ID list types in libosmocore

2018-02-27 Thread Stefan Sperling

Patch Set 6:

> > Understood. Are we willing to make an exception and break the API
 > > in this case or not? When we spoke some days ago, my take-away
 > was
 > > that were were willing to make a breaking change in this
 > particular
 > > case.
 > 
 > when was the API introduced? Which users are using it?  Are there
 > any tagged releases of our software that would fail to build if
 > this change was made?  This is what matters to the users.

The API was introduced in 
http://git.osmocom.org/libosmocore/commit/?id=783047e86ec64677f3894bd22576315eee631275
which is contained in the libosmocore-0.10.0 tag.

I suppose this means we should keep the API?

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb
Gerrit-PatchSet: 6
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Stefan Sperling 
Gerrit-HasComments: No


[MERGED] osmo-bts[master]: scheduler: Add missing \n at end of LOG statement

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: scheduler: Add missing \n at end of LOG statement
..


scheduler: Add missing \n at end of LOG statement

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

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



diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index 90de09c..e6cf541 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -307,7 +307,7 @@
LOGL1S(DL1P, LOGL_NOTICE, l1t, tn, chan, fn,
 "Prim %u is out of range (100), or channel %s with 
"
 "type %s is already disabled. If this happens in "
-"conjunction with PCU, increase 'rts-advance' by 
5.",
+"conjunction with PCU, increase 'rts-advance' by 
5.\n",
 prim_fn, get_lchan_by_chan_nr(l1t->trx, 
chan_nr)->name,
 get_value_string(trx_chan_type_names, chan));
/* unlink and free message */

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

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


osmocom-bb[fixeria/trx]: fake_trx/ctrl_if_bb.py: add FAKE_RSSI and FAKE_TOA commands

2018-02-27 Thread Harald Welte

Patch Set 2:

see https://gerrit.osmocom.org/#/c/6955/

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia23becec4104d47e7b22350db67b8834d6f1ad1b
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: fixeria/trx
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[MERGED] libosmocore[master]: l1sap: Add RSSI, BER and quarter-bit accurate timing to PH-R...

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: l1sap: Add RSSI, BER and quarter-bit accurate timing to 
PH-RACH.ind
..


l1sap: Add RSSI, BER and quarter-bit accurate timing to PH-RACH.ind

Let's extend PH-RACH.ind with some useful data across the L1SAP
boundary.

Change-Id: I9439810c3a3ad89ea0302753617b850749af887c
Related: OS#3003
---
M include/osmocom/gsm/l1sap.h
1 file changed, 4 insertions(+), 0 deletions(-)

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



diff --git a/include/osmocom/gsm/l1sap.h b/include/osmocom/gsm/l1sap.h
index 1bc1818..18ad7d2 100644
--- a/include/osmocom/gsm/l1sap.h
+++ b/include/osmocom/gsm/l1sap.h
@@ -64,6 +64,10 @@
uint32_t fn;/*!< GSM Frame Number at time of RA */
uint8_t is_11bit;   /*!< no.of bits in RACH*/
enum ph_burst_type burst_type; /*!< type of burst*/
+   /* elements added on 2018-02-26 */
+   int8_t rssi;/*!< RSSI of RACH indication */
+   uint16_t ber10k;/*!< BER in units of 0.01% */
+   int16_t acc_delay_256bits;/* !< Burst TA Offset in 1/256th bits */
 };
 
 /*! for PH-[UNIT]DATA.{req,ind} | PH-RTS.ind */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9439810c3a3ad89ea0302753617b850749af887c
Gerrit-PatchSet: 4
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


libosmocore[master]: l1sap: Add RSSI, BER and quarter-bit accurate timing to PH-R...

2018-02-27 Thread Harald Welte

Patch Set 4: Code-Review+2

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

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


[PATCH] osmo-bts[master]: Move rach_busy counting above L1SAP

2018-02-27 Thread Harald Welte
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6931

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

Move rach_busy counting above L1SAP

In the past, rach_busy counting was performed below L1SAP, while
reporting was handled above.  This lead to subtle differences between
the BTS models, such as osmo-bts-trx missing to increment rach_busy.

Let's move the rach_busy counting above L1SAP to share more code.

This means we need libosmocore Change-Id
I9439810c3a3ad89ea0302753617b850749af887c for the additional required
parameters in ph_rach_ind_param, as well as libosmocore Change-id
I2b1926a37bde860dcfeb0d613eb55a71271928c5 for osmo-bts-trx to determine
the RACH bit error rate.

Change-Id: I3b989580cb38082e3fd8fc50a11fedda13991092
Closes: OS#3003
---
M src/common/l1sap.c
M src/osmo-bts-litecell15/l1_if.c
M src/osmo-bts-octphy/l1_if.c
M src/osmo-bts-sysmo/l1_if.c
M src/osmo-bts-trx/scheduler_trx.c
5 files changed, 44 insertions(+), 48 deletions(-)


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

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 2623d84..90f045a 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1190,7 +1190,23 @@
uint8_t acc_delay;
 
DEBUGPFN(DL1P, rach_ind->fn, "Rx PH-RA.ind");
+
+   /* check for handover access burst on dedicated channels */
+   if (!L1SAP_IS_CHAN_RACH(rach_ind->chan_nr)) {
+   rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_RACH_HO);
+   return l1sap_handover_rach(trx, l1sap, rach_ind);
+   }
+
rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_RACH_RCVD);
+
+   /* increment number of busy RACH slots, if required */
+   if (rach_ind->rssi >= btsb->load.rach.busy_thresh)
+   btsb->load.rach.busy++;
+
+   /* FIXME: RACH filtering due to BER limit */
+
+   /* increment number of RACH slots with valid non-handover RACH burst */
+   btsb->load.rach.access++;
 
lc = >ts[0].lchan[CCCH_LCHAN].lapdm_ch;
 
@@ -1204,12 +1220,6 @@
 
/* According to 3GPP TS 48.058 § 9.3.17 Access Delay is expressed same 
way as TA (number of symbols) */
set_ms_to_data(get_lchan_by_chan_nr(trx, rach_ind->chan_nr), acc_delay, 
false);
-
-   /* check for handover rach */
-   if (!L1SAP_IS_CHAN_RACH(rach_ind->chan_nr)) {
-   rate_ctr_inc2(trx->bts->ctrs, BTS_CTR_RACH_HO);
-   return l1sap_handover_rach(trx, l1sap, rach_ind);
-   }
 
/* check for packet access */
if ((trx == bts->c0 && L1SAP_IS_PACKET_RACH(rach_ind->ra)) ||
diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index 9c3b867..1b83fbd 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -1002,23 +1002,15 @@
uint16_t ra = 0, is_11bit = 0, burst_type = 0, temp = 0;
int rc;
 
-   /* increment number of busy RACH slots, if required */
-   if (trx == bts->c0 &&
-   ra_ind->measParam.fRssi >= btsb->load.rach.busy_thresh)
-   btsb->load.rach.busy++;
-
+   /* FIXME: this should be deprecated/obsoleted as it bypasses rach.busy 
counting */
if (ra_ind->measParam.fLinkQuality < btsb->min_qual_rach) {
msgb_free(l1p_msg);
return 0;
}
 
+   /* the old legacy full-bits acc_delay cannot express negative values */
if (ra_ind->measParam.i16BurstTiming > 0)
acc_delay = ra_ind->measParam.i16BurstTiming >> 2;
-
-   /* increment number of RACH slots with valid non-handover RACH burst */
-   lchan = l1if_hLayer_to_lchan(trx, (uint32_t)ra_ind->hLayer2);
-   if (trx == bts->c0 && !(lchan && lchan->ho.active == HANDOVER_ENABLED))
-   btsb->load.rach.access++;
 
dump_meas_res(LOGL_DEBUG, _ind->measParam);
burst_type = ra_ind->burstType;
@@ -1052,6 +1044,9 @@
l1sap->u.rach_ind.acc_delay = acc_delay;
l1sap->u.rach_ind.fn = fn;
l1sap->u.rach_ind.is_11bit = is_11bit; /* no of bits in 11 bit RACH */
+   l1sap->u.rach_ind.rssi = (int8_t) ra_ind->measParam.fRssi;
+   l1sap->u.rach_ind.ber10k = (unsigned int) (ra_ind->measParam.fBer * 
1.0);
+   l1sap->u.rach_ind.acc_delay_256bits = ra_ind->measParam.i16BurstTiming 
* 64;
 
/* mapping of the burst type, the values are specific to
 * osmo-bts-litecell15 */
@@ -1074,6 +1069,7 @@
break;
}
 
+   lchan = l1if_hLayer_to_lchan(trx, (uint32_t)ra_ind->hLayer2);
if (!lchan || lchan->ts->pchan == GSM_PCHAN_CCCH ||
lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4 ||
lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH)
diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index ddaa9b3..535ac8b 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -1167,30 +1167,17 @@
struct gsm_bts_trx *trx = trx_by_l1h(fl1, ra_ind->TrxId.byTrxId);
 

[PATCH] osmo-bts[master]: trx/scheduler: Use integer math for TOA (Timing of Arrival)

2018-02-27 Thread Harald Welte
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6955

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

trx/scheduler: Use integer math for TOA (Timing of Arrival)

There's no need to express TOA as a float:
* We receive it as signed 16bit integer in units 1/256 symbol periods
* We pass it to L1SAP as signed integer in 1/4 symbol periods

So turn it into an int16_t with 1/256 symbol period accuracy throughout
the code to avoid both float arithmetic as well as loosing any precision.

Change-Id: Idce4178e0b1f7e940ebc22b3e2f340fcd544d4ec
---
M include/osmo-bts/scheduler.h
M include/osmo-bts/scheduler_backend.h
M src/common/scheduler.c
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-trx/l1_if.h
M src/osmo-bts-trx/loops.c
M src/osmo-bts-trx/loops.h
M src/osmo-bts-trx/scheduler_trx.c
M src/osmo-bts-trx/trx_if.c
M src/osmo-bts-virtual/scheduler_virtbts.c
10 files changed, 73 insertions(+), 70 deletions(-)


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

diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 4d34315..98f38d3 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -75,7 +75,7 @@
uint8_t rssi_num;   /* number of RSSI values */
float   rssi_sum;   /* sum of RSSI values */
uint8_t toa_num;/* number of TOA values */
-   float   toa_sum;/* sum of TOA values */
+   int32_t toa256_sum; /* sum of TOA values (1/256 
symbol) */
 
/* loss detection */
uint8_t lost;   /* (SACCH) loss detection */
@@ -113,7 +113,7 @@
int rssi_count; /* received RSSI values */
int rssi_valid_count; /* number of stored value */
int rssi_got_burst; /* any burst received so far */
-   float   toa_sum;/* sum of TOA values */
+   int32_t toa256_sum; /* sum of TOA values (1/256 
symbol) */
int toa_num;/* number of TOA value */
} meas;
 
@@ -165,7 +165,7 @@
 
 /*! \brief handle an UL burst received by PHY */
 int trx_sched_ul_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
-sbit_t *bits, uint16_t nbits, int8_t rssi, float toa);
+sbit_t *bits, uint16_t nbits, int8_t rssi, int16_t toa);
 
 /*! \brief set multiframe scheduler to given physical channel config */
 int trx_sched_set_pchan(struct l1sched_trx *l1t, uint8_t tn,
diff --git a/include/osmo-bts/scheduler_backend.h 
b/include/osmo-bts/scheduler_backend.h
index 5e077ef..5f11f9b 100644
--- a/include/osmo-bts/scheduler_backend.h
+++ b/include/osmo-bts/scheduler_backend.h
@@ -16,7 +16,7 @@
 typedef int trx_sched_ul_func(struct l1sched_trx *l1t, uint8_t tn,
  uint32_t fn, enum trx_chan_type chan,
  uint8_t bid, sbit_t *bits, uint16_t nbits,
- int8_t rssi, float toa);
+ int8_t rssi, int16_t toa256);
 
 struct trx_chan_desc {
/*! \brief Is this on a PDCH (PS) ? */
@@ -74,19 +74,19 @@
enum trx_chan_type chan, uint8_t bid, uint16_t *nbits);
 int rx_rach_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
-   int8_t rssi, float toa);
+   int8_t rssi, int16_t toa256);
 int rx_data_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
-   int8_t rssi, float toa);
+   int8_t rssi, int16_t toa256);
 int rx_pdtch_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
-   int8_t rssi, float toa);
+   int8_t rssi, int16_t toa256);
 int rx_tchf_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
-   int8_t rssi, float toa);
+   int8_t rssi, int16_t toa256);
 int rx_tchh_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
enum trx_chan_type chan, uint8_t bid, sbit_t *bits, uint16_t nbits,
-   int8_t rssi, float toa);
+   int8_t rssi, int16_t toa256);
 
 const ubit_t *_sched_dl_burst(struct l1sched_trx *l1t, uint8_t tn,
  uint32_t fn, uint16_t *nbits);
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index e6cf541..edd99d2 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -846,7 +846,7 @@
 
 /* process uplink burst */
 int trx_sched_ul_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t 
current_fn,
-   sbit_t *bits, uint16_t nbits, int8_t rssi, float toa)
+   sbit_t *bits, uint16_t nbits, int8_t rssi, int16_t toa256)
 {
struct l1sched_ts *l1ts = 

[PATCH] osmo-bts[master]: L1SAP: Increase resolution of reported burst timing

2018-02-27 Thread Harald Welte

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

L1SAP: Increase resolution of reported burst timing

Before this patch we had:
* osmo-bts-trx internally using 1/256th bit/symbol period
* osmo-bts-sysmo internally using 1/4 bit/smbol period
* PCU interface using 1/4
* L1SAP interface using 1/4
* measurement processing code on top of L1SAP using 1/256

So for sysmo/lc15/octphy we are not loosing resolution, but for
osmo-bts-trx we're arbitrarily reducing the resolution via L1SAP
only then to compute with higher resolution again.

Let's change L1SAP to use 1/256 bits and hence not loose any resolution.
This requires a corresponding change in libosmocore for l1sap.h, which
is found in Change-Id Ibb58113c2819fe2d6d23ecbcfb8b3fce4055025d

Change-Id: If9b0f617845ba6c4aa47969f521734388197c9a7
---
M include/osmo-bts/scheduler_backend.h
M src/common/l1sap.c
M src/common/scheduler.c
M src/osmo-bts-litecell15/l1_if.c
M src/osmo-bts-octphy/l1_if.c
M src/osmo-bts-sysmo/l1_if.c
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-virtual/l1_if.c
8 files changed, 19 insertions(+), 19 deletions(-)


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

diff --git a/include/osmo-bts/scheduler_backend.h 
b/include/osmo-bts/scheduler_backend.h
index 5f11f9b..dbd9319 100644
--- a/include/osmo-bts/scheduler_backend.h
+++ b/include/osmo-bts/scheduler_backend.h
@@ -51,7 +51,7 @@
 int _sched_compose_ph_data_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t 
fn,
   enum trx_chan_type chan, uint8_t *l2,
   uint8_t l2_len, float rssi,
-  int16_t ta_offs_qbits, int16_t link_qual_cb,
+  int16_t ta_offs_256bits, int16_t link_qual_cb,
   uint16_t ber10k,
   enum osmo_ph_pres_info_type presence_info);
 
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index e095417..330b40a 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -512,8 +512,8 @@
}
 
DEBUGPFN(DL1P, info_meas_ind->fn,
-   "%s MPH_INFO meas ind, ta_offs_qbits=%d, ber10k=%d, 
inv_rssi=%u\n",
-   gsm_lchan_name(lchan), info_meas_ind->ta_offs_qbits,
+   "%s MPH_INFO meas ind, ta_offs_256bits=%d, ber10k=%d, 
inv_rssi=%u\n",
+   gsm_lchan_name(lchan), info_meas_ind->ta_offs_256bits,
info_meas_ind->ber10k, info_meas_ind->inv_rssi);
 
/* in the GPRS case we are not interested in measurement
@@ -522,13 +522,13 @@
return 0;
 
memset(, 0, sizeof(ulm));
-   ulm.ta_offs_256bits = info_meas_ind->ta_offs_qbits*(256/4);
+   ulm.ta_offs_256bits = info_meas_ind->ta_offs_256bits;
ulm.ber10k = info_meas_ind->ber10k;
ulm.inv_rssi = info_meas_ind->inv_rssi;
ulm.is_sub = info_meas_ind->is_sub;
 
/* we assume that symbol period is 1 bit: */
-   set_ms_to_data(lchan, info_meas_ind->ta_offs_qbits / 4, true);
+   set_ms_to_data(lchan, info_meas_ind->ta_offs_256bits / 256, true);
 
lchan_new_ul_meas(lchan, , info_meas_ind->fn);
 
@@ -1058,7 +1058,7 @@
pcu_tx_data_ind(>ts[tn], PCU_IF_SAPI_PTCCH, fn,
0 /* ARFCN */, L1SAP_FN2PTCCHBLOCK(fn),
data, len, rssi, data_ind->ber10k,
-   data_ind->ta_offs_qbits,
+   data_ind->ta_offs_256bits/64,
data_ind->lqual_cb);
} else {
/* drop incomplete UL block */
@@ -1067,7 +1067,7 @@
/* PDTCH / PACCH frame handling */
pcu_tx_data_ind(>ts[tn], PCU_IF_SAPI_PDTCH, fn, 0 
/* ARFCN */,
L1SAP_FN2MACBLOCK(fn), data, len, rssi, 
data_ind->ber10k,
-   data_ind->ta_offs_qbits, 
data_ind->lqual_cb);
+   data_ind->ta_offs_256bits/64, 
data_ind->lqual_cb);
}
return 0;
}
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index edd99d2..8c9d30d 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -340,7 +340,7 @@
 int _sched_compose_ph_data_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t 
fn,
   enum trx_chan_type chan, uint8_t *l2,
   uint8_t l2_len, float rssi,
-  int16_t ta_offs_qbits, int16_t link_qual_cb,
+  int16_t ta_offs_256bits, int16_t link_qual_cb,
   uint16_t ber10k,
   enum osmo_ph_pres_info_type presence_info)
 {
@@ -359,7 +359,7 @@
l1sap->u.data.fn = fn;
l1sap->u.data.rssi = (int8_t) (rssi);
l1sap->u.data.ber10k = ber10k;
-   l1sap->u.data.ta_offs_qbits = 

[PATCH] osmo-bts[master]: WIP: higher-precision TA/TOA math

2018-02-27 Thread Harald Welte

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

WIP: higher-precision TA/TOA math

Change-Id: I0dc8e78545465dfc5c93691a49b86b6b8b56b432
---
M include/osmo-bts/gsm_data_shared.h
M src/common/l1sap.c
M src/common/measurement.c
3 files changed, 8 insertions(+), 8 deletions(-)


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

diff --git a/include/osmo-bts/gsm_data_shared.h 
b/include/osmo-bts/gsm_data_shared.h
index 7cefb10..770aea8 100644
--- a/include/osmo-bts/gsm_data_shared.h
+++ b/include/osmo-bts/gsm_data_shared.h
@@ -165,8 +165,8 @@
 struct bts_ul_meas {
/* BER in units of 0.01%: 10.000 == 100% ber, 0 == 0% ber */
uint16_t ber10k;
-   /* timing advance offset (in quarter bits) */
-   int16_t ta_offs_qbits;
+   /* timing advance offset (in 1/256 bits) */
+   int16_t ta_offs_256bits;
/* C/I ratio in dB */
float c_i;
/* flags */
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 50bd612..e095417 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -522,7 +522,7 @@
return 0;
 
memset(, 0, sizeof(ulm));
-   ulm.ta_offs_qbits = info_meas_ind->ta_offs_qbits;
+   ulm.ta_offs_256bits = info_meas_ind->ta_offs_qbits*(256/4);
ulm.ber10k = info_meas_ind->ber10k;
ulm.inv_rssi = info_meas_ind->inv_rssi;
ulm.is_sub = info_meas_ind->is_sub;
diff --git a/src/common/measurement.c b/src/common/measurement.c
index 98d9403..bdb2850 100644
--- a/src/common/measurement.c
+++ b/src/common/measurement.c
@@ -342,7 +342,7 @@
uint32_t irssi_full_sum = 0;
uint32_t ber_sub_sum = 0;
uint32_t irssi_sub_sum = 0;
-   int32_t taqb_sum = 0;
+   int32_t ta256b_sum = 0;
unsigned int num_meas_sub = 0;
int i;
 
@@ -362,7 +362,7 @@
 
ber_full_sum += m->ber10k;
irssi_full_sum += m->inv_rssi;
-   taqb_sum += m->ta_offs_qbits;
+   ta256b_sum += m->ta_offs_256bits;
 
if (m->is_sub) {
num_meas_sub++;
@@ -374,7 +374,7 @@
/* step 2: divide */
ber_full_sum = ber_full_sum / lchan->meas.num_ul_meas;
irssi_full_sum = irssi_full_sum / lchan->meas.num_ul_meas;
-   taqb_sum = taqb_sum / lchan->meas.num_ul_meas;
+   ta256b_sum = ta256b_sum / lchan->meas.num_ul_meas;
 
if (num_meas_sub) {
ber_sub_sum = ber_sub_sum / num_meas_sub;
@@ -387,9 +387,9 @@
irssi_sub_sum = 120; /* -120 dBm */
}
 
-   LOGP(DMEAS, LOGL_INFO, "%s Computed TA(% 4dqb) BER-FULL(%2u.%02u%%), 
RSSI-FULL(-%3udBm), "
+   LOGP(DMEAS, LOGL_INFO, "%s Computed TA256(% 4d) BER-FULL(%2u.%02u%%), 
RSSI-FULL(-%3udBm), "
"BER-SUB(%2u.%02u%%), RSSI-SUB(-%3udBm)\n", 
gsm_lchan_name(lchan),
-   taqb_sum, ber_full_sum/100,
+   ta256b_sum, ber_full_sum/100,
ber_full_sum%100, irssi_full_sum, ber_sub_sum/100, 
ber_sub_sum%100,
irssi_sub_sum);
 

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

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


[PATCH] osmo-bts[master]: WIP: FIX REL_IND merge mismatch

2018-02-27 Thread Harald Welte

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

WIP: FIX REL_IND merge mismatch

Change-Id: I823c9101bcca72d5792e16379b02d3602ffc2726
---
M src/common/rsl.c
1 file changed, 7 insertions(+), 7 deletions(-)


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

diff --git a/src/common/rsl.c b/src/common/rsl.c
index 5c266ba..a012b5d 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -2477,6 +2477,13 @@
LOGP(DRSL, LOGL_INFO, "%s Handing RLL msg %s from LAPDm to MEAS 
REP\n",
gsm_lchan_name(lchan), rsl_msg_name(rh->msg_type));
 
+   rc = rsl_tx_meas_res(lchan, msgb_l3(msg), msgb_l3len(msg), le);
+   msgb_free(msg);
+   return rc;
+   } else {
+   LOGP(DRSL, LOGL_INFO, "%s Fwd RLL msg %s from LAPDm to A-bis\n",
+   gsm_lchan_name(lchan), rsl_msg_name(rh->msg_type));
+
/* REL_IND handling */
if (rh->msg_type == RSL_MT_REL_IND &&
(lchan->type == GSM_LCHAN_TCH_F || lchan->type == 
GSM_LCHAN_TCH_H)) {
@@ -2492,13 +2499,6 @@
lchan->pending_rel_ind_msg = msg;
return 0;
}
-
-   rc = rsl_tx_meas_res(lchan, msgb_l3(msg), msgb_l3len(msg), le);
-   msgb_free(msg);
-   return rc;
-   } else {
-   LOGP(DRSL, LOGL_INFO, "%s Fwd RLL msg %s from LAPDm to A-bis\n",
-   gsm_lchan_name(lchan), rsl_msg_name(rh->msg_type));
 
return abis_bts_rsl_sendmsg(msg);
}

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

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


[PATCH] libosmocore[master]: l1sap: Add RSSI, BER and quarter-bit accurate timing to PH-R...

2018-02-27 Thread Harald Welte
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6926

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

l1sap: Add RSSI, BER and quarter-bit accurate timing to PH-RACH.ind

Let's extend PH-RACH.ind with some useful data across the L1SAP
boundary.

Change-Id: I9439810c3a3ad89ea0302753617b850749af887c
Related: OS#3003
---
M include/osmocom/gsm/l1sap.h
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/26/6926/4

diff --git a/include/osmocom/gsm/l1sap.h b/include/osmocom/gsm/l1sap.h
index 1bc1818..18ad7d2 100644
--- a/include/osmocom/gsm/l1sap.h
+++ b/include/osmocom/gsm/l1sap.h
@@ -64,6 +64,10 @@
uint32_t fn;/*!< GSM Frame Number at time of RA */
uint8_t is_11bit;   /*!< no.of bits in RACH*/
enum ph_burst_type burst_type; /*!< type of burst*/
+   /* elements added on 2018-02-26 */
+   int8_t rssi;/*!< RSSI of RACH indication */
+   uint16_t ber10k;/*!< BER in units of 0.01% */
+   int16_t acc_delay_256bits;/* !< Burst TA Offset in 1/256th bits */
 };
 
 /*! for PH-[UNIT]DATA.{req,ind} | PH-RTS.ind */

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I9439810c3a3ad89ea0302753617b850749af887c
Gerrit-PatchSet: 4
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmocom-bb[fixeria/trx]: fake_trx/ctrl_if_bb.py: add FAKE_RSSI and FAKE_TOA commands

2018-02-27 Thread Harald Welte

Patch Set 2:

I'm about to eradicate the evilness of floating point math in OsmoBTS. No idea 
why it was introduced in the first place. All input and output is integer, so 
why use float in between, particularly when no computation is performed on 
float at all?

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia23becec4104d47e7b22350db67b8834d6f1ad1b
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: fixeria/trx
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmocom-bb[fixeria/trx]: fake_trx/ctrl_if_bb.py: add FAKE_RSSI and FAKE_TOA commands

2018-02-27 Thread Vadim Yanitskiy

Patch Set 2:

> Also, one nice feature woudl be to reset the FAKE_* values on
 > POWEROFF/POWERON on the BTS side, but that's currently difficult
 > due to the data structures.  So I resorted to the test always
 > explicitly sending FAKE_* commands at the start of each test, not
 > having to rely on any state left over from before.

Good idea, I'll have a look.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia23becec4104d47e7b22350db67b8834d6f1ad1b
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: fixeria/trx
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmocom-bb[fixeria/trx]: fake_trx/ctrl_if_bb.py: add FAKE_RSSI and FAKE_TOA commands

2018-02-27 Thread Vadim Yanitskiy

Patch Set 2:

Hi Harald,

> I'm completely fine with FAKE_TOA, but why would you ever
> intenionally use a float value?  The Burst data carries int16_t. IF
> you input a float value, you may end up having conversion/rounding
> differences in how python rounds the float to how the Test suite
> rounds the float - they may even run on different machines, etc.
>
> In the end, we want to generate an int16_t from fake_trx inside the
> bursts.  Why would you use a different type as the input parameter?

I am agree with you, and I don't even sure about portability level
of the current field coding implemented in the DATAMSG API. Moreover,
there is only have ToA 'float to bytes' conversation implemented,
while parsing 'ToA from raw bytes' is missing so far...

But in general, why the usage of 'raw' int16_t is better than
the usage of float ToA value? I think, e.g. '-1.6' value is much
easier to keep in mind, which means that a signal arrived 1.6
symbols earlier than it was expected...

Following your idea, OsmoTRX does use exactly symbols, and
before sending a burst, converts double value to int16_t:

> TOAint = (int) (TOA * 256.0 + 0.5);
> burstString[6] = (TOAint >> 8) & 0x0ff;
> burstString[7] = TOAint & 0x0ff;

and OsmoBTS then also recovers raw bytes to float:

> float toa = ((int16_t)(buf[6] << 8) | buf[7]) / 256.0F;

Isn't there any possible incompatibility, e.g. in case
of both OsmoTRX and OsmoBTS are working on different machines?

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia23becec4104d47e7b22350db67b8834d6f1ad1b
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: fixeria/trx
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


libosmocore[master]: support for more cell ID list types in libosmocore

2018-02-27 Thread Harald Welte

Patch Set 6:

> Understood. Are we willing to make an exception and break the API
 > in this case or not? When we spoke some days ago, my take-away was
 > that were were willing to make a breaking change in this particular
 > case.

when was the API introduced? Which users are using it?  Are there any tagged 
releases of our software that would fail to build if this change was made?  
This is what matters to the users.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb
Gerrit-PatchSet: 6
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Stefan Sperling 
Gerrit-HasComments: No


libosmocore[master]: support for more cell ID list types in libosmocore

2018-02-27 Thread Stefan Sperling

Patch Set 6:

> My main concern is API compatibility in a sense that old
 > applications should always work with new/future library code.  ABI
 > compatibility is important but less so, as we keep incrementing the
 > LIBVERSION every so often anyway (in fact, right now such a
 > libversion change is going on again).

Understood. Are we willing to make an exception and break the API in this case 
or not? When we spoke some days ago, my take-away was that were were willing to 
make a breaking change in this particular case.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb
Gerrit-PatchSet: 6
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Stefan Sperling 
Gerrit-HasComments: No


[MERGED] libosmocore[master]: core: Add timespec helper macros and make timer_compat.h public

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: core: Add timespec helper macros and make timer_compat.h public
..


core: Add timespec helper macros and make timer_compat.h public

If a monotonic clock must be used, then the clock_gettime API is used
which uses timespec structures. Linux systems by default don't provide
helpers to calculate time using timespecs, so let's add them here.

Let's also make this header public so these helpers can be used in other
projects using libosmocore (expected user: libosmo-netif).

Change-Id: I45fc993b9bb0a343763238bf463c8640f47b00f1
---
M include/Makefile.am
M include/osmocom/core/timer_compat.h
2 files changed, 45 insertions(+), 1 deletion(-)

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



diff --git a/include/Makefile.am b/include/Makefile.am
index f95d90c..8b05f80 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -47,6 +47,7 @@
osmocom/core/strrb.h \
osmocom/core/talloc.h \
osmocom/core/timer.h \
+   osmocom/core/timer_compat.h \
osmocom/core/utils.h \
osmocom/core/write_queue.h \
osmocom/crypt/auth.h \
@@ -148,7 +149,6 @@
 endif
 
 noinst_HEADERS = \
-   osmocom/core/timer_compat.h \
osmocom/gsm/kasumi.h osmocom/gsm/gea.h
 
 osmocom/core/bit%gen.h: osmocom/core/bitXXgen.h.tpl
diff --git a/include/osmocom/core/timer_compat.h 
b/include/osmocom/core/timer_compat.h
index 77d4ce0..8fdd0a0 100644
--- a/include/osmocom/core/timer_compat.h
+++ b/include/osmocom/core/timer_compat.h
@@ -71,5 +71,49 @@
   } while (0)
 #endif
 
+/* Convenience macros for operations on timespecs.
+   NOTE: `timercmp' does not work for >= or <=.  */
+
+#ifndef timespecisset
+# define timespecisset(tvp)((tvp)->tv_sec || (tvp)->tv_nsec)
+#endif
+
+#ifndef timespecclear
+# define timespecclear(tvp)((tvp)->tv_sec = (tvp)->tv_nsec = 0)
+#endif
+
+#ifndef timespeccmp
+# define timespeccmp(a, b, CMP)  \
+  (((a)->tv_sec == (b)->tv_sec) ?\
+   ((a)->tv_nsec CMP (b)->tv_nsec) : \
+   ((a)->tv_sec CMP (b)->tv_sec))
+#endif
+
+#ifndef timespecadd
+# define timespecadd(a, b, result)   \
+  do {   \
+(result)->tv_sec = (a)->tv_sec + (b)->tv_sec;\
+(result)->tv_nsec = (a)->tv_nsec + (b)->tv_nsec; \
+if ((result)->tv_nsec >= 10) \
+  {
  \
+   ++(result)->tv_sec;   \
+   (result)->tv_nsec -= 10;  \
+  }
  \
+  } while (0)
+#endif
+
+#ifndef timespecsub
+# define timespecsub(a, b, result)   \
+  do {   \
+(result)->tv_sec = (a)->tv_sec - (b)->tv_sec;\
+(result)->tv_nsec = (a)->tv_nsec - (b)->tv_nsec; \
+if ((result)->tv_nsec < 0) { \
+  --(result)->tv_sec;\
+  (result)->tv_nsec += 10;   \
+}\
+  } while (0)
+#endif
+
+
 
 /*! @} */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I45fc993b9bb0a343763238bf463c8640f47b00f1
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


libosmocore[master]: core: Add timespec helper macros and make timer_compat.h public

2018-02-27 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


libosmocore[master]: timer: Introduce osmo_clock_gettime to override clock_gettime

2018-02-27 Thread Harald Welte

Patch Set 1: Code-Review+1

(1 comment)

https://gerrit.osmocom.org/#/c/6961/1/src/timer_clockgettime.c
File src/timer_clockgettime.c:

Line 23: /*! \addtogroup timer
I think what's missing here is a nice description on why this API exists, what 
it is used for, and how one would use it - ending up with our doxygen 
documentation for the libosmocore API documentation.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I5bebc6e01fc9d238065bc2517058f0ba85620349
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: Yes


libosmocore[master]: timer: Introduce osmo_clock_gettime to override clock_gettime

2018-02-27 Thread Harald Welte

Patch Set 1:

another approach would have been to always use osmo_gettimeofday internally and 
provide a weak symbol inside the library, which a user could override with a 
strong symbol.  But that ouf course would leave it to the user to implement his 
own logic for advancing time, without the infrastructure provided here.

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

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


osmo-ci[master]: osmo-clean-workspace: fix force checkout of a subdirectory

2018-02-27 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: If23e89872edf48dc5b751b3c069faf585bd6a3ef
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


libosmocore[master]: support for more cell ID list types in libosmocore

2018-02-27 Thread Harald Welte

Patch Set 6:

My main concern is API compatibility in a sense that old applications should 
always work with new/future library code.  ABI compatibility is important but 
less so, as we keep incrementing the LIBVERSION every so often anyway (in fact, 
right now such a libversion change is going on again).

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb
Gerrit-PatchSet: 6
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Stefan Sperling 
Gerrit-HasComments: No


libosmocore[master]: support for more cell ID list types in libosmocore

2018-02-27 Thread Stefan Sperling

Patch Set 6:

(8 comments)

https://gerrit.osmocom.org/#/c/6509/6/include/osmocom/gsm/gsm0808_utils.h
File include/osmocom/gsm/gsm0808_utils.h:

Line 64: #define CELL_ID_LIST_GLOBAL_MAXLEN (CELL_ID_LIST_MAXLEN / 
sizeof(struct osmo_cell_global_id))
> I see now, you're limiting by the maximum possible number that fits in a si
As explained above, the idea is to avoid growing beyond the old structure's 
size.


Line 64: #define CELL_ID_LIST_GLOBAL_MAXLEN (CELL_ID_LIST_MAXLEN / 
sizeof(struct osmo_cell_global_id))
> gosh, I'd just define like 128 items for all and be done with it
This grew out of an attempt to keep things compatible at least on the ABI 
level. Binaries compiled against old libosmocore will keep working against new 
libosmocore because sizes don't change and the LAC which old binaries care 
about is still in the same spot.


Line 69: struct gsm0808_cell_id_list {
> it is actually defined in 3GPP TS 48.008 3.2.2.27 Cell Identifier List ... 
Yes, as mentioned in the log message this changeset is currently breaking one 
known API consumer. See https://gerrit.osmocom.org/#/c/6518/


Line 70:uint8_t id_discr;
> We have enum CELL_IDENT in libosmocore/include/osmocom/gsm/protocol/gsm_08_
The values from this enum are in fact what this field has always been using. If 
we change the datatype to an enum then code compiled against old libosmocore 
will use the wrong offsets. The uint16_t was inherited from old code. It should 
really have been an enum in the first place. I'd rather change that in a second 
step unless we decide that keeping old binaries working is not important.


Line 71:union {
> I also thought of this as a union first, but since most of these elements a
I don't know. It seems to me that this is a perfect use case  for a union, 
precisely because it prevents ambiguity about which fields are valid. After 
all, a struct where only some fields are valid is pretty much like a union but 
with a risk of ambiguity and wasted space, isn't it?

I looked at existing structs and reused them where I could. But not all of them 
fit what's needed here. It seems that historically most of the osmo code cared 
about LAC only, and that's why these changes are needed now as we want to 
extend beyond that.

What I don't really like is that this union strongly mirrors the on-wire format 
so a unified representation might be better. Then again, a lot of code down the 
line cares about the distinction, e.g. the paging code wants to know which 
varianet of IDs appeared on the wire.


https://gerrit.osmocom.org/#/c/6509/6/src/gsm/gsm0808_utils.c
File src/gsm/gsm0808_utils.c:

Line 576: uint8_t gsm0808_enc_cell_id_list(struct msgb *msg,
> The signature of this function changes silently, by a dramatically differen
The old API is defined in the wrong place (host-side struct in protocol-side 
header file), is a weird mix of wire-format sizes for data types which actually 
contain host-side representation of the data in host byte-order, and is 
insufficient for what it is supposed to represent because it cannot even encode 
all cell list types. In short, the old API is entirely broken and confused.
I discussed it with pmaier who added this old API, and he agreed that it was a 
mistake. 

We could keep it around for backwards compat if you prefer that, which also 
means keeping the old code that used it.
But since there is only one known user, I'd argue we can remove it safely and 
should. To ease this transition I designed the new API to remain ABI compatible 
with the old one, but I am not in love with that idea either and would be happy 
to break that, too.

If any third party is using this problematic API they must switch to the new 
one anyway when they upgrade libosmocore. I see no value in keeping their old 
code working in this situation.


Line 656:   return gsm48_decode_lai(, mcc, mnc, lac) != 0 ? -1 : 0;
> (I'd scrap the '!= 0')
I tend to use != 0 if there's a negative error return or zero in case of 
success. and I don't use !=0 if the return value is really a boolean. But 
that's a minor detail, I'm happy with either style.

In fact, gsm48_decode_lai() never fails and should probably return void.


Line 829:   return 1 + (int)bytes_elem;
> maybe comment that it is the id_discr + N elements ... I was a bit confused
Yes, added in next patch set.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib7e754f538df0c83298a3c958b4e15a32fcb8abb
Gerrit-PatchSet: 6
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Stefan Sperling 
Gerrit-HasComments: Yes


[PATCH] osmo-ci[master]: osmo-clean-workspace: fix force checkout of a subdirectory

2018-02-27 Thread lynxis lazus

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

osmo-clean-workspace: fix force checkout of a subdirectory

Instead of the subdirectory, the main repository was
forced checked out.

Change-Id: If23e89872edf48dc5b751b3c069faf585bd6a3ef
---
M scripts/osmo-clean-workspace.sh
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/scripts/osmo-clean-workspace.sh b/scripts/osmo-clean-workspace.sh
index 11a5b72..4b77066 100755
--- a/scripts/osmo-clean-workspace.sh
+++ b/scripts/osmo-clean-workspace.sh
@@ -31,12 +31,12 @@
 # but clean each git of build artifacts.
 if [ -d "$deps" ]; then
   for dep_dir in "$deps"/* ; do
-git checkout -f HEAD
+git -C "$dep_dir" checkout -f HEAD
 git -C "$dep_dir" clean -dxf
   done
 fi
 
 if [ -d "layer1-headers" ]; then
-  git checkout -f HEAD
+  git -C "layer1-headers" checkout -f HEAD
   git -C "layer1-headers" clean -dxf
 fi

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If23e89872edf48dc5b751b3c069faf585bd6a3ef
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 


[PATCH] osmo-sgsn[master]: implement support for 3-digit MNC with leading zeros

2018-02-27 Thread Neels Hofmeyr
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6672

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

implement support for 3-digit MNC with leading zeros

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

Note that in gbproxy_test.ok, 0-0 changes to 000-000 instead of 000-00, because
the parsed ra buffer is 00 which results in 000-000, while 00f000 would
result in 000-00. IOW this is expected.

Change-Id: I7437dfaa586689e2bef0d4be6537e5577a8f6c26
---
M include/osmocom/sgsn/gb_proxy.h
M src/gprs/gb_proxy.c
M src/gprs/gb_proxy_patch.c
M src/gprs/gb_proxy_vty.c
M src/gprs/gprs_gb_parse.c
M src/gprs/gprs_gmm.c
M src/gprs/gprs_utils.c
M src/gprs/sgsn_auth.c
M src/gprs/sgsn_vty.c
M tests/gbproxy/gbproxy_test.c
M tests/gbproxy/gbproxy_test.ok
11 files changed, 103 insertions(+), 105 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/72/6672/2

diff --git a/include/osmocom/sgsn/gb_proxy.h b/include/osmocom/sgsn/gb_proxy.h
index e10894f..2540a7e 100644
--- a/include/osmocom/sgsn/gb_proxy.h
+++ b/include/osmocom/sgsn/gb_proxy.h
@@ -3,6 +3,7 @@
 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -101,8 +102,7 @@
struct rate_ctr_group *ctrg;
 
/* force mcc/mnc */
-   int core_mnc;
-   int core_mcc;
+   struct osmo_plmn_id core_plmn;
uint8_t* core_apn;
size_t core_apn_size;
int tlli_max_age;
@@ -120,8 +120,7 @@
 };
 
 struct gbproxy_patch_state {
-   int local_mnc;
-   int local_mcc;
+   struct osmo_plmn_id local_plmn;
 
/* List of TLLIs for which patching is enabled */
struct llist_head logical_links;
diff --git a/src/gprs/gb_proxy.c b/src/gprs/gb_proxy.c
index 63c3a61..7d21518 100644
--- a/src/gprs/gb_proxy.c
+++ b/src/gprs/gb_proxy.c
@@ -192,8 +192,7 @@
   const char *log_text)
 {
struct gbproxy_patch_state *state = >patch_state;
-   const int old_local_mcc = state->local_mcc;
-   const int old_local_mnc = state->local_mnc;
+   const struct osmo_plmn_id old_plmn = state->local_plmn;
struct gprs_ra_id raid;
 
if (!raid_enc)
@@ -202,28 +201,31 @@
gsm48_parse_ra(, raid_enc);
 
/* save source side MCC/MNC */
-   if (!peer->cfg->core_mcc || raid.mcc == peer->cfg->core_mcc) {
-   state->local_mcc = 0;
+   if (!peer->cfg->core_plmn.mcc || raid.mcc == peer->cfg->core_plmn.mcc) {
+   state->local_plmn.mcc = 0;
} else {
-   state->local_mcc = raid.mcc;
+   state->local_plmn.mcc = raid.mcc;
}
 
-   if (!peer->cfg->core_mnc || raid.mnc == peer->cfg->core_mnc) {
-   state->local_mnc = 0;
+   if (!peer->cfg->core_plmn.mnc
+   || !osmo_mnc_cmp(raid.mnc, raid.mnc_3_digits,
+peer->cfg->core_plmn.mnc, 
peer->cfg->core_plmn.mnc_3_digits)) {
+   state->local_plmn.mnc = 0;
+   state->local_plmn.mnc_3_digits = false;
} else {
-   state->local_mnc = raid.mnc;
+   state->local_plmn.mnc = raid.mnc;
+   state->local_plmn.mnc_3_digits = raid.mnc_3_digits;
}
 
-   if (old_local_mcc != state->local_mcc ||
-   old_local_mnc != state->local_mnc)
+   if (osmo_plmn_cmp(_plmn, >local_plmn))
LOGP(DGPRS, LOGL_NOTICE,
 "Patching RAID %sactivated, msg: %s, "
-"local: %d-%d, core: %d-%d\n",
-state->local_mcc || state->local_mnc ?
+"local: %s, core: %s\n",
+state->local_plmn.mcc || state->local_plmn.mnc ?
 "" : "de",
 log_text,
-state->local_mcc, state->local_mnc,
-peer->cfg->core_mcc, peer->cfg->core_mnc);
+osmo_plmn_name(>local_plmn),
+osmo_plmn_name2(>cfg->core_plmn));
 }
 
 uint32_t gbproxy_make_bss_ptmsi(struct gbproxy_peer *peer,
@@ -559,7 +561,7 @@
struct gbproxy_link_info *link_info = NULL;
uint32_t sgsn_nsei = cfg->nsip_sgsn_nsei;
 
-   if (!cfg->core_mcc && !cfg->core_mnc && !cfg->core_apn &&
+   if (!cfg->core_plmn.mcc && !cfg->core_plmn.mnc && !cfg->core_apn &&
!cfg->acquire_imsi && !cfg->patch_ptmsi && !cfg->route_to_sgsn2)
return 1;
 
@@ -665,7 +667,7 @@
return 1;
 }
 
-/* patch BSSGP message to use core_mcc/mnc on the SGSN side */
+/* patch BSSGP message to use core_plmn.mcc/mnc on the SGSN side */
 static void gbprox_process_bssgp_dl(struct gbproxy_config *cfg,
struct msgb *msg,
struct gbproxy_peer *peer)
@@ -677,7 +679,7 @@
struct timespec ts = {0,};
struct gbproxy_link_info *link_info = 

libosmocore[master]: gsm: add osmo_mnc_from_str(), osmo_mnc_cmp(), osmo_plmn_cmp(...

2018-02-27 Thread Harald Welte

Patch Set 7: Code-Review+2

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

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



[MERGED] osmo-bsc[master]: Add support for Access Control Class ramping.

2018-02-27 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Add support for Access Control Class ramping.
..


Add support for Access Control Class ramping.

Access Control Class (ACC) ramping is used to slowly make the cell
available to an increasing number of MS. This avoids overload at
startup time in cases where a lot of MS would discover the new
cell and try to connect to it all at once.

Ramping behaviour can be configured with new VTY commands:

  [no] access-control-class-ramping
  access-control-class-ramping-step-interval (<30-600>|dynamic)
  access-control-class-ramping-step-size (<1-10>)

(The minimum and maximum values for these parameters are hard-coded,
but could be changed if they are found to be inadequate.)

The VTY command 'show bts' has been extended to display the
current ACC ramping configuration.

By default, ACC ramping is disabled.

When enabled, the default behaviour is to enable one ACC per
ramping step with a 'dynamic' step interval. This means the
ramping interval (time between steps) is scaled to the channel
load average of the BTS, i.e. the number of used vs. available
channels measured over a certain amount of time.

Below is an example of debug log output with ACC ramping enabled,
while many 'mobile' programs are concurrently trying to connect
to the network via an osmo-bts-virtual BTS. Initially, all ACCs
are barred, and then only one class is allowed. Then the current
BTS channel load average is consulted for scheduling the next
ramping step. While the channel load average is low, ramping
proceeds faster, and while it is is high, ramping proceeds slower:

(bts=0) ACC RAMP: barring Access Control Class 0
(bts=0) ACC RAMP: barring Access Control Class 1
(bts=0) ACC RAMP: barring Access Control Class 2
(bts=0) ACC RAMP: barring Access Control Class 3
(bts=0) ACC RAMP: barring Access Control Class 4
(bts=0) ACC RAMP: barring Access Control Class 5
(bts=0) ACC RAMP: barring Access Control Class 6
(bts=0) ACC RAMP: barring Access Control Class 7
(bts=0) ACC RAMP: barring Access Control Class 8
(bts=0) ACC RAMP: barring Access Control Class 9
(bts=0) ACC RAMP: allowing Access Control Class 0
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load 
average
(bts=0) ACC RAMP: allowing Access Control Class 1
(bts=0) ACC RAMP: step interval set to 354 seconds based on 59% channel load 
average
(bts=0) ACC RAMP: allowing Access Control Class 2
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load 
average
(bts=0) ACC RAMP: allowing Access Control Class 3
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load 
average

Change-Id: I0a5ac3a08f992f326435944f17e0a9171911afb0
Related: OS#2591
---
M include/osmocom/bsc/Makefile.am
A include/osmocom/bsc/acc_ramp.h
M include/osmocom/bsc/gsm_data.h
M src/libbsc/Makefile.am
A src/libbsc/acc_ramp.c
M src/libbsc/bsc_init.c
M src/libbsc/bsc_vty.c
M src/libbsc/chan_alloc.c
M src/libbsc/gsm_data.c
M src/libbsc/system_information.c
10 files changed, 533 insertions(+), 3 deletions(-)

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



diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index a5d7d18..17e8bd3 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -3,6 +3,7 @@
abis_nm.h \
abis_om2000.h \
abis_rsl.h \
+   acc_ramp.h \
arfcn_range_encode.h \
bsc_msc.h \
bsc_msg_filter.h \
diff --git a/include/osmocom/bsc/acc_ramp.h b/include/osmocom/bsc/acc_ramp.h
new file mode 100644
index 000..cb063bf
--- /dev/null
+++ b/include/osmocom/bsc/acc_ramp.h
@@ -0,0 +1,149 @@
+/* (C) 2018 by sysmocom s.f.m.c. GmbH 
+ *
+ * Author: Stefan Sperling 
+ *
+ * All Rights Reserved
+ *
+ * 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 .
+ *
+ */
+
+#pragma once
+
+#include 
+#include 
+
+#include 
+#include 
+
+/*!
+ * Access control class (ACC) ramping is used to slowly make the cell 
available to
+ * an increasing number of MS. This avoids overload at startup time in cases 
where
+ * a lot of MS would discover the new cell and try to connect to it all at 
once.
+ */
+
+#define ACC_RAMP_STEP_SIZE_MIN 1 /* allow at most 1 new 

  1   2   >