osmocom-bb[master]: Fix memory leak when not using a lua script

2018-02-23 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1 Verified+1

Works for me, thanks!

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I510af13bcbb46f73a0a289f26a4921cc90bd986a
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: fixeria 
Gerrit-HasComments: No


[PATCH] osmocom-bb[master]: mobile: Fix memory leak when not using a LUA script

2018-02-23 Thread Vadim Yanitskiy
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6845

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

mobile: Fix memory leak when not using a LUA script

The primitives are still allocated and dispatched but there was
no script handler to delete them. Change the ownership to delete
it at the end of the dispatch.

Change-Id: I510af13bcbb46f73a0a289f26a4921cc90bd986a
Fixes: OS#2925
---
M src/host/layer23/src/mobile/primitives.c
M src/host/layer23/src/mobile/script_lua.c
2 files changed, 1 insertion(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/45/6845/2

diff --git a/src/host/layer23/src/mobile/primitives.c 
b/src/host/layer23/src/mobile/primitives.c
index c3f28a5..2d3e4ad 100644
--- a/src/host/layer23/src/mobile/primitives.c
+++ b/src/host/layer23/src/mobile/primitives.c
@@ -107,6 +107,7 @@
if (intf->ms == ms)
intf->indication(intf, prim);
}
+   msgb_free(prim->hdr.msg);
 }
 
 void mobile_prim_ntfy_started(struct osmocom_ms *ms, bool started)
diff --git a/src/host/layer23/src/mobile/script_lua.c 
b/src/host/layer23/src/mobile/script_lua.c
index 9b256d3..8d3064d 100644
--- a/src/host/layer23/src/mobile/script_lua.c
+++ b/src/host/layer23/src/mobile/script_lua.c
@@ -451,8 +451,6 @@
default:
LOGP(DLUA, LOGL_ERROR, "Unknown primitive: %d\n", 
OSMO_PRIM_HDR(&prim->hdr));
};
-
-   msgb_free(prim->hdr.msg);
 }
 
 /*

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I510af13bcbb46f73a0a289f26a4921cc90bd986a
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: fixeria 


osmocom-bb[master]: mobile: Fix memory leak when not using a LUA script

2018-02-23 Thread Vadim Yanitskiy

Patch Set 2: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I510af13bcbb46f73a0a289f26a4921cc90bd986a
Gerrit-PatchSet: 2
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: fixeria 
Gerrit-HasComments: No


osmocom-bb[master]: mobile: Fix memory leak when not using a LUA script

2018-02-23 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


[MERGED] osmocom-bb[master]: mobile: Fix memory leak when not using a LUA script

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

Change subject: mobile: Fix memory leak when not using a LUA script
..


mobile: Fix memory leak when not using a LUA script

The primitives are still allocated and dispatched but there was
no script handler to delete them. Change the ownership to delete
it at the end of the dispatch.

Change-Id: I510af13bcbb46f73a0a289f26a4921cc90bd986a
Fixes: OS#2925
---
M src/host/layer23/src/mobile/primitives.c
M src/host/layer23/src/mobile/script_lua.c
2 files changed, 1 insertion(+), 2 deletions(-)

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



diff --git a/src/host/layer23/src/mobile/primitives.c 
b/src/host/layer23/src/mobile/primitives.c
index 96f0f9c..aa46712 100644
--- a/src/host/layer23/src/mobile/primitives.c
+++ b/src/host/layer23/src/mobile/primitives.c
@@ -110,6 +110,7 @@
if (intf->ms == ms)
intf->indication(intf, prim);
}
+   msgb_free(prim->hdr.msg);
 }
 
 void mobile_prim_ntfy_started(struct osmocom_ms *ms, bool started)
diff --git a/src/host/layer23/src/mobile/script_lua.c 
b/src/host/layer23/src/mobile/script_lua.c
index 9b256d3..8d3064d 100644
--- a/src/host/layer23/src/mobile/script_lua.c
+++ b/src/host/layer23/src/mobile/script_lua.c
@@ -451,8 +451,6 @@
default:
LOGP(DLUA, LOGL_ERROR, "Unknown primitive: %d\n", 
OSMO_PRIM_HDR(&prim->hdr));
};
-
-   msgb_free(prim->hdr.msg);
 }
 
 /*

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

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


osmo-iuh[master]: ensure unique CellIDs in HNB-GW

2018-02-23 Thread Harald Welte

Patch Set 3: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iffd441eb2b6b75dfbe001b49b01bea015ca6e11c
Gerrit-PatchSet: 3
Gerrit-Project: osmo-iuh
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-iuh[master]: ensure unique CellIDs in HNB-GW

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

Change subject: ensure unique CellIDs in HNB-GW
..


ensure unique CellIDs in HNB-GW

If we receive a HNB-REGISTER-REQ with a cell ID which is already used
by another registered NNB, log an error and send HNB-REGISTER-REJECT.

Tested manually by running two 'hnb-test' programs concurrently (they
need to listen on different telnet ports; this port is hard-coded so
I compiled two different hnb-test binaries).
Then I issued the 'hnbap hnb register' command on the telnet interface
of each, and verified that the correct action is logged by osmo-hnbgw.
Both hnb-test programs can connect, but only one of them can register
at a time. Killing a registered 'hnb-test' program terminates its
connection and allows the previously rejected one to register.

The new rejection log message looks like this:
 hnbgw_hnbap.c:429 rejecting HNB-REGISTER-REQ with duplicate cell
 identity MCC=901,MNC=99,LAC=49406,RAC=66,SAC=43947,CID=182250155
 from (r=127.0.0.1:42828<->l=127.0.0.1:29169)

This change depends on a new API in libosmo-netif, which is added in
https://gerrit.osmocom.org/#/c/6844/

Change-Id: Iffd441eb2b6b75dfbe001b49b01bea015ca6e11c
Depends: I8ed78fe39c463e9018756700d13ee5ebe003b57f
Related: OS#2789
---
M include/osmocom/iuh/hnbgw.h
M src/hnbgw.c
M src/hnbgw_hnbap.c
3 files changed, 73 insertions(+), 6 deletions(-)

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



diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h
index 094f31f..b79bcc1 100644
--- a/include/osmocom/iuh/hnbgw.h
+++ b/include/osmocom/iuh/hnbgw.h
@@ -97,6 +97,10 @@
/*! SCTP stream ID for RUA */
uint16_t rua_stream;
 
+   /*! True if a HNB-REGISTER-REQ from this HNB has been accepted. Note 
that
+* this entire data structure is freed if the HNB sends 
HNB-DE-REGISTER-REQ. */
+   bool hnb_registered;
+
/* linked list of hnbgw_context_map */
struct llist_head map_list;
 };
@@ -157,7 +161,7 @@
 void ue_context_free(struct ue_context *ue);
 
 struct hnb_context *hnb_context_alloc(struct hnb_gw *gw, struct 
osmo_stream_srv_link *link, int new_fd);
-void hnb_context_release(struct hnb_context *ctx);
+void hnb_context_release(struct hnb_context *ctx, bool destroy_conn);
 
 void hnbgw_vty_init(struct hnb_gw *gw, void *tall_ctx);
 int hnbgw_vty_go_parent(struct vty *vty);
diff --git a/src/hnbgw.c b/src/hnbgw.c
index cd492bb..94d8fb9 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -204,6 +204,12 @@
 }
 static int hnb_close_cb(struct osmo_stream_srv *conn)
 {
+   struct hnb_context *hnb = osmo_stream_srv_get_data(conn);
+
+   /* This connection is about to be closed. Destroy the HNB context now. 
*/
+   if (hnb)
+   hnb_context_release(hnb, false);
+
return 0;
 }
 
@@ -228,10 +234,10 @@
} else if (rc < 0) {
LOGP(DMAIN, LOGL_ERROR, "Error during sctp_recvmsg()\n");
/* FIXME: clean up after disappeared HNB */
-   hnb_context_release(hnb);
+   hnb_context_release(hnb, true);
goto out;
} else if (rc == 0) {
-   hnb_context_release(hnb);
+   hnb_context_release(hnb, true);
rc = -1;
 
goto out;
@@ -288,7 +294,7 @@
return ctx;
 }
 
-void hnb_context_release(struct hnb_context *ctx)
+void hnb_context_release(struct hnb_context *ctx, bool destroy_conn)
 {
struct hnbgw_context_map *map, *map2;
 
@@ -305,7 +311,9 @@
context_map_deactivate(map);
}
ue_context_free_by_hnb(ctx->gw, ctx);
-   osmo_stream_srv_destroy(ctx->conn);
+
+   if (destroy_conn)
+   osmo_stream_srv_destroy(ctx->conn);
 
talloc_free(ctx);
 }
diff --git a/src/hnbgw_hnbap.c b/src/hnbgw_hnbap.c
index 8fba13c..acc5aff 100644
--- a/src/hnbgw_hnbap.c
+++ b/src/hnbgw_hnbap.c
@@ -20,6 +20,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -46,6 +47,45 @@
osmo_stream_srv_send(ctx->conn, msg);
 
return 0;
+}
+
+static int hnbgw_tx_hnb_register_rej(struct hnb_context *ctx)
+{
+   HNBRegisterReject_t reject_out;
+   HNBRegisterRejectIEs_t reject;
+   struct msgb *msg;
+   int rc;
+
+   reject.presenceMask = 0,
+   reject.cause.present = Cause_PR_radioNetwork;
+   reject.cause.choice.radioNetwork = CauseRadioNetwork_unspecified;
+
+   /* encode the Information Elements */
+   memset(&reject_out, 0, sizeof(reject_out));
+   rc = hnbap_encode_hnbregisterrejecties(&reject_out,  &reject);
+   if (rc < 0) {
+   LOGP(DHNBAP, LOGL_ERROR, "Failure to encode HNB-REGISTER-REJECT 
to %s: rc=%d\n",
+ctx->identity_info, rc);
+   return rc;
+   }
+
+   /* generate a successfull outcome PDU */
+   msg = hnbap_generate_unsuccessful_outco

osmo-mgw[master]: enable osmo_fsm vty commands in libosmo-mgcp-client vty

2018-02-23 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: If772edc304a9f342a57fb548f26908256cc9e6e5
Gerrit-PatchSet: 1
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-msc[master]: enable osmo_fsm vty commands in osmo-msc vty

2018-02-23 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iaf970f6039c3f668f275dd8c21fb9071774a5d9e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmocore[master]: ensure that osmo_fsm vty commands are only installed once

2018-02-23 Thread Harald Welte

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/6843/1/src/vty/fsm_vty.c
File src/vty/fsm_vty.c:

Line 192:   if (!osmo_fsm_vty_cmds_installed) {
what we normally do is 

if (osmo_fsm_vty_cmds_installed)
 return;

to avoid having to indent all of the other statements in the function body and 
loose horizontal screen real-estate.

Also, if we go for this pattern, there are many other instances where the vty 
commands are installed from libraries.

One might even hide the logic inside install_element itse?lf? not sure.


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

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


[MERGED] osmo-msc[master]: enable osmo_fsm vty commands in osmo-msc vty

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

Change subject: enable osmo_fsm vty commands in osmo-msc vty
..


enable osmo_fsm vty commands in osmo-msc vty

Call osmo_fsm_vty_add_cmds() to make osmo_fsm VTY commands available
in osmo-msc's VTY interface.

Change-Id: Iaf970f6039c3f668f275dd8c21fb9071774a5d9e
Related: OS#2967
---
M src/libmsc/msc_vty.c
1 file changed, 2 insertions(+), 0 deletions(-)

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



diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index 77ced8e..ce608ba 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -28,6 +28,7 @@
 #include 
 
 #include 
+#include 
 #ifdef BUILD_IU
 #include 
 #endif
@@ -239,4 +240,5 @@
 #ifdef BUILD_IU
ranap_iu_vty_init(MSC_NODE, (enum 
ranap_nsap_addr_enc*)&msc_network->iu.rab_assign_addr_enc);
 #endif
+   osmo_fsm_vty_add_cmds();
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaf970f6039c3f668f275dd8c21fb9071774a5d9e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-mgw[master]: enable osmo_fsm vty commands in libosmo-mgcp-client vty

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

Change subject: enable osmo_fsm vty commands in libosmo-mgcp-client vty
..


enable osmo_fsm vty commands in libosmo-mgcp-client vty

Call osmo_fsm_vty_add_cmds() to make osmo_fsm VTY commands available
in libosmo-mgcp-client's VTY interface.

Change-Id: If772edc304a9f342a57fb548f26908256cc9e6e5
Related: OS#2967
---
M src/libosmo-mgcp-client/mgcp_client_vty.c
1 file changed, 3 insertions(+), 0 deletions(-)

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



diff --git a/src/libosmo-mgcp-client/mgcp_client_vty.c 
b/src/libosmo-mgcp-client/mgcp_client_vty.c
index 6e8bd56..10d078a 100644
--- a/src/libosmo-mgcp-client/mgcp_client_vty.c
+++ b/src/libosmo-mgcp-client/mgcp_client_vty.c
@@ -25,6 +25,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 #include 
@@ -203,4 +204,6 @@
install_element(node, &cfg_mgcpgw_remote_port_cmd);
install_element(node, &cfg_mgcpgw_endpoint_range_cmd);
install_element(node, &cfg_mgcpgw_rtp_bts_base_port_cmd);
+
+   osmo_fsm_vty_add_cmds();
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If772edc304a9f342a57fb548f26908256cc9e6e5
Gerrit-PatchSet: 1
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmocom-bb[fixeria/trx]: trxcon: change default port number to 5703 to avoid clashes ...

2018-02-23 Thread Harald Welte

Patch Set 1:

actually, 5703 is used by OsmoTRX for the second trx.

I think it's a bad idea to re-use the same port numbers / port number range on 
the MS side which are used on the network side.  Is there any requirement to do 
so?  why not simply shift the entire base port (5700) on the client side to 
something else like 6700?

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I66b5f25aaba3b836448ed29839c39869b5622bed
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: fixeria/trx
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmocom-bb[fixeria/trx]: trxcon: change default port number to 5703 to avoid clashes ...

2018-02-23 Thread Vadim Yanitskiy

Patch Set 1:

> actually, 5703 is used by OsmoTRX for the second trx.
 > 
 > I think it's a bad idea to re-use the same port numbers / port
 > number range on the MS side which are used on the network side.  Is
 > there any requirement to do so?  why not simply shift the entire
 > base port (5700) on the client side to something else like 6700?

Absolutely agree with you. The 6700 range is ok for me.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I66b5f25aaba3b836448ed29839c39869b5622bed
Gerrit-PatchSet: 1
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


[PATCH] osmocom-bb[fixeria/trx]: Add FAKE_RSSI and FAKE_TIMING commands on BB side

2018-02-23 Thread Harald Welte

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

Add FAKE_RSSI and FAKE_TIMING commands on BB side

This is useful for testing the measurement processing code in OsmoBTS

Change-Id: Ia23becec4104d47e7b22350db67b8834d6f1ad1b
---
M src/target/fake_trx/burst_fwd.py
M src/target/fake_trx/ctrl_if_bb.py
2 files changed, 21 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/46/6846/1

diff --git a/src/target/fake_trx/burst_fwd.py b/src/target/fake_trx/burst_fwd.py
index 5989ce9..8b04be1 100644
--- a/src/target/fake_trx/burst_fwd.py
+++ b/src/target/fake_trx/burst_fwd.py
@@ -25,6 +25,8 @@
 class BurstForwarder:
# Timeslot filter (drop everything by default)
ts_pass = None
+   rssi = 0x35
+   timing = 0
 
# Freq. filter
bts_freq = None
@@ -44,11 +46,11 @@
payload = bytearray(data)
length = len(payload)
 
-   # HACK: set fake RSSI value (-53)
-   payload[5] = 0x35
+   # set fake RSSI value (-53)
+   payload[5] = self.rssi
 
-   # HACK: add fake TOA value (6th and 7th bytes)
-   payload[6:2] = [0x00, 0x00]
+   # add fake TOA value (6th and 7th bytes)
+   payload[6:2] = [self.timing >> 8, self.timing & 0xff]
 
# Convert ubits to {255..0}
for i in range(8, length):
diff --git a/src/target/fake_trx/ctrl_if_bb.py 
b/src/target/fake_trx/ctrl_if_bb.py
index 440094a..f8ad5b4 100644
--- a/src/target/fake_trx/ctrl_if_bb.py
+++ b/src/target/fake_trx/ctrl_if_bb.py
@@ -118,6 +118,21 @@
self.burst_fwd.ts_pass = ts
 
return 0
+   elif self.verify_cmd(request, "FAKE_RSSI", 1):
+   print("[i] Recv FAKE_RSSI cmd")
+   self.burst_fwd.rssi = int(request[1])
+   # HACK: We don't return a response, as the command is 
typicaly sent
+   # by another program (test controller) and we don't 
want to confuse
+   # trxcon with bogus responses
+   return -1
+
+   elif self.verify_cmd(request, "FAKE_TIMING", 1):
+   print("[i] Recv FAKE_TIMING cmd")
+   self.burst_fwd.timing = int(request[1])
+   # HACK: We don't return a response, as the command is 
typicaly sent
+   # by another program (test controller) and we don't 
want to confuse
+   # trxcon with bogus responses
+   return -1
 
# Wrong / unknown command
else:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia23becec4104d47e7b22350db67b8834d6f1ad1b
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: fixeria/trx
Gerrit-Owner: Harald Welte 


osmocom-bb[fixeria/trx]: Add FAKE_RSSI and FAKE_TIMING commands on BB side

2018-02-23 Thread Vadim Yanitskiy

Patch Set 1: Code-Review-1

Not sure if it's a good idea to reuse an active CTRL connection
for such purposes... I would prefer to have a separate connection
(on a separate user-defined port), probably also behaving like CTRL.

-- 
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: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: fixeria/trx
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[PATCH] osmocom-bb[fixeria/trx]: trxcon|fake_trx: change default TRX port number to 6700

2018-02-23 Thread Vadim Yanitskiy
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6839

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

trxcon|fake_trx: change default TRX port number to 6700

In order to avoid clashes with OsmoTRX, which may be also
running on the same host, let's use a different port range
starting from 6700 by default.

This idea was introduced as a result of OS#2984.

Change-Id: I66b5f25aaba3b836448ed29839c39869b5622bed
Related: OS#2984
---
M src/host/trxcon/trxcon.c
M src/target/fake_trx/fake_trx.py
2 files changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/39/6839/2

diff --git a/src/host/trxcon/trxcon.c b/src/host/trxcon/trxcon.c
index 07ab169..0250b72 100644
--- a/src/host/trxcon/trxcon.c
+++ b/src/host/trxcon/trxcon.c
@@ -143,7 +143,7 @@
printf("  -h --help this text\n");
printf("  -d --debugChange debug flags. Default: %s\n", 
DEBUG_DEFAULT);
printf("  -i --trx-ip   IP address of host runing TRX (default 
127.0.0.1)\n");
-   printf("  -p --trx-port Base port of TRX instance (default 
5700)\n");
+   printf("  -p --trx-port Base port of TRX instance (default 
6700)\n");
printf("  -f --trx-advance  Scheduler clock advance (default 20)\n");
printf("  -s --socket   Listening socket for layer23 (default 
/tmp/osmocom_l2)\n");
printf("  -D --daemonizeRun as daemon\n");
@@ -203,7 +203,7 @@
 {
app_data.bind_socket = "/tmp/osmocom_l2";
app_data.trx_ip = "127.0.0.1";
-   app_data.trx_base_port = 5700;
+   app_data.trx_base_port = 6700;
app_data.trx_fn_advance = 20;
 
app_data.debug_mask = NULL;
diff --git a/src/target/fake_trx/fake_trx.py b/src/target/fake_trx/fake_trx.py
index 962101c..4f6d8c6 100755
--- a/src/target/fake_trx/fake_trx.py
+++ b/src/target/fake_trx/fake_trx.py
@@ -47,7 +47,7 @@
bts_addr = "127.0.0.1"
bb_addr = "127.0.0.1"
bts_base_port = 5700
-   bb_base_port = 5703
+   bb_base_port = 6700
 
def __init__(self):
self.print_copyright()

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I66b5f25aaba3b836448ed29839c39869b5622bed
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 


[PATCH] libosmocore[master]: ensure that osmo_fsm vty commands are only installed once

2018-02-23 Thread Stefan Sperling
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6843

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

ensure that osmo_fsm vty commands are only installed once

There is a desire to install osmo_fsm vty commands automatically in
a library context, rather than requiring every application which
directly or indirectly uses osmo_fsm to run osmo_fsm_vty_add_cmd().

However, the function install_element_ve() asserts that elements
about to be installed have not already been installed.

This means we cannot shift responsibility into a library context
without first making sure that osmo_fsm commands are only installed
once per combined application+library context, because applications
won't know which commands any of its libraries has already installed.

A simple solution is to use a global flag which is checked by
osmo_fsm_vty_add_cmd() before installing osmo_fsm commands, and
is set once the commands have been installed. This way, no harm
is done if osmo_fsm_vty_add_cmd() is called multiple times.

Change-Id: I10b0b1c1c1bf44c3b8eafc465c1ee06ea2590682
Related: OS#2967
---
M src/vty/fsm_vty.c
1 file changed, 12 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/43/6843/2

diff --git a/src/vty/fsm_vty.c b/src/vty/fsm_vty.c
index 8abb9c9..2947678 100644
--- a/src/vty/fsm_vty.c
+++ b/src/vty/fsm_vty.c
@@ -181,8 +181,20 @@
  *  application if you want to support those commands. */
 void osmo_fsm_vty_add_cmds(void)
 {
+   static bool osmo_fsm_vty_cmds_installed;
+
+   /* Make sure FSM commands get installed only once.
+* We might be called from libraries or from an application.
+* An application might be oblivious to the fact that one or
+* more of its libaries are using osmo_fsm. And likewise,
+* any given library will not know if another library has
+* already installled these commands. */
+   if (osmo_fsm_vty_cmds_installed)
+   return;
+
install_element_ve(&show_fsm_cmd);
install_element_ve(&show_fsms_cmd);
install_element_ve(&show_fsm_inst_cmd);
install_element_ve(&show_fsm_insts_cmd);
+   osmo_fsm_vty_cmds_installed = true;
 }

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I10b0b1c1c1bf44c3b8eafc465c1ee06ea2590682
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


libosmocore[master]: ensure that osmo_fsm vty commands are only installed once

2018-02-23 Thread Stefan Sperling

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/6843/1/src/vty/fsm_vty.c
File src/vty/fsm_vty.c:

Line 192:   if (!osmo_fsm_vty_cmds_installed) {
> what we normally do is 
I doubt we have cases where distinct libraries are installing *the same* vty 
commands already. Any such case should either have run into assert() and be 
noticed, or users of such libraries have so far been lucky enough to only ever 
link to one such library.


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

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


libosmocore[master]: ensure that osmo_fsm vty commands are only installed once

2018-02-23 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


[MERGED] libosmocore[master]: ensure that osmo_fsm vty commands are only installed once

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

Change subject: ensure that osmo_fsm vty commands are only installed once
..


ensure that osmo_fsm vty commands are only installed once

There is a desire to install osmo_fsm vty commands automatically in
a library context, rather than requiring every application which
directly or indirectly uses osmo_fsm to run osmo_fsm_vty_add_cmd().

However, the function install_element_ve() asserts that elements
about to be installed have not already been installed.

This means we cannot shift responsibility into a library context
without first making sure that osmo_fsm commands are only installed
once per combined application+library context, because applications
won't know which commands any of its libraries has already installed.

A simple solution is to use a global flag which is checked by
osmo_fsm_vty_add_cmd() before installing osmo_fsm commands, and
is set once the commands have been installed. This way, no harm
is done if osmo_fsm_vty_add_cmd() is called multiple times.

Change-Id: I10b0b1c1c1bf44c3b8eafc465c1ee06ea2590682
Related: OS#2967
---
M src/vty/fsm_vty.c
1 file changed, 12 insertions(+), 0 deletions(-)

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



diff --git a/src/vty/fsm_vty.c b/src/vty/fsm_vty.c
index 8abb9c9..2947678 100644
--- a/src/vty/fsm_vty.c
+++ b/src/vty/fsm_vty.c
@@ -181,8 +181,20 @@
  *  application if you want to support those commands. */
 void osmo_fsm_vty_add_cmds(void)
 {
+   static bool osmo_fsm_vty_cmds_installed;
+
+   /* Make sure FSM commands get installed only once.
+* We might be called from libraries or from an application.
+* An application might be oblivious to the fact that one or
+* more of its libaries are using osmo_fsm. And likewise,
+* any given library will not know if another library has
+* already installled these commands. */
+   if (osmo_fsm_vty_cmds_installed)
+   return;
+
install_element_ve(&show_fsm_cmd);
install_element_ve(&show_fsms_cmd);
install_element_ve(&show_fsm_inst_cmd);
install_element_ve(&show_fsm_insts_cmd);
+   osmo_fsm_vty_cmds_installed = true;
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I10b0b1c1c1bf44c3b8eafc465c1ee06ea2590682
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Stefan Sperling 


osmo-trx[master]: Move enums required by VTY to a separate header

2018-02-23 Thread Harald Welte

Patch Set 5: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3d5b0576aa96869756f1629a40306c0043b6304b
Gerrit-PatchSet: 5
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[MERGED] osmocom-bb[fixeria/trx]: trxcon|fake_trx: change default TRX port number to 6700

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

Change subject: trxcon|fake_trx: change default TRX port number to 6700
..


trxcon|fake_trx: change default TRX port number to 6700

In order to avoid clashes with OsmoTRX, which may be also
running on the same host, let's use a different port range
starting from 6700 by default.

This idea was introduced as a result of OS#2984.

Change-Id: I66b5f25aaba3b836448ed29839c39869b5622bed
Related: OS#2984
---
M src/host/trxcon/trxcon.c
M src/target/fake_trx/fake_trx.py
2 files changed, 3 insertions(+), 3 deletions(-)

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



diff --git a/src/host/trxcon/trxcon.c b/src/host/trxcon/trxcon.c
index 07ab169..0250b72 100644
--- a/src/host/trxcon/trxcon.c
+++ b/src/host/trxcon/trxcon.c
@@ -143,7 +143,7 @@
printf("  -h --help this text\n");
printf("  -d --debugChange debug flags. Default: %s\n", 
DEBUG_DEFAULT);
printf("  -i --trx-ip   IP address of host runing TRX (default 
127.0.0.1)\n");
-   printf("  -p --trx-port Base port of TRX instance (default 
5700)\n");
+   printf("  -p --trx-port Base port of TRX instance (default 
6700)\n");
printf("  -f --trx-advance  Scheduler clock advance (default 20)\n");
printf("  -s --socket   Listening socket for layer23 (default 
/tmp/osmocom_l2)\n");
printf("  -D --daemonizeRun as daemon\n");
@@ -203,7 +203,7 @@
 {
app_data.bind_socket = "/tmp/osmocom_l2";
app_data.trx_ip = "127.0.0.1";
-   app_data.trx_base_port = 5700;
+   app_data.trx_base_port = 6700;
app_data.trx_fn_advance = 20;
 
app_data.debug_mask = NULL;
diff --git a/src/target/fake_trx/fake_trx.py b/src/target/fake_trx/fake_trx.py
index 962101c..4f6d8c6 100755
--- a/src/target/fake_trx/fake_trx.py
+++ b/src/target/fake_trx/fake_trx.py
@@ -47,7 +47,7 @@
bts_addr = "127.0.0.1"
bb_addr = "127.0.0.1"
bts_base_port = 5700
-   bb_base_port = 5703
+   bb_base_port = 6700
 
def __init__(self):
self.print_copyright()

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I66b5f25aaba3b836448ed29839c39869b5622bed
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 


osmocom-bb[fixeria/trx]: trxcon|fake_trx: change default TRX port number to 6700

2018-02-23 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I66b5f25aaba3b836448ed29839c39869b5622bed
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


osmo-trx[master]: osmo-trx.cpp: Move trx start and stop to helper functions

2018-02-23 Thread Harald Welte

Patch Set 5: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I10eaaafe38ace2b7bb095a0ad1db70d6c06ee03b
Gerrit-PatchSet: 5
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-trx[master]: osmo-trx: Drop cmd lines and use VTY cfg

2018-02-23 Thread Harald Welte

Patch Set 5:

I'm not sure we want to remove them. We might leave them for some time to keep 
backwards compatibility to existing startup scripts etc?

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib8de1a5da4b3c0b6a49e00033f616e1d66656adf
Gerrit-PatchSet: 5
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-trx[master]: vty: Implement VTY cfg parsing for current parameters

2018-02-23 Thread Harald Welte

Patch Set 5:

I don't think any of our vty has "on|off" so far. We have a enable/disable or 
0/1 ,(or cmd / no cmd). Let's not introduce even more inconsistencies, please.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie084c1b30b63f91c6e7640832ec1797d9e813832
Gerrit-PatchSet: 5
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


osmo-msc[master]: mcgp: let the MGW allocate the MGCP endpoint

2018-02-23 Thread Stefan Sperling

Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/#/c/6319/2/src/libmsc/msc_mgcp.c
File src/libmsc/msc_mgcp.c:

Line 252:   MGCP_ENDPOINT_MAXLEN) {
While this code is correct because sizeof(mgcp_msg.endpoint) and 
MGCP_ENDPOINT_MAXLEN have the same value, I would stick to the idiom:

  if (strlcpy(dst, src, dstsize) >= dstsize)

So I'd use the exact same value for the dstsize argument and the truncation 
check, either sizeof(mgcp_msg.endpoint) or MGCP_ENDPOINT_MAXLEN, but would 
avoid mixing them.

The reason is just that this is a common idiom people auditing code will be 
looking for. Not obviously using the same value raises a red flag in a 
reviewer's mind.

See also the EXAMPLES section in http://man.openbsd.org/strlcpy


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iee3e446b6689626516f01c521abe3d4603cd3e13
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: dexter 
Gerrit-HasComments: Yes


osmo-trx[master]: Logger: Use libosmocore logging system

2018-02-23 Thread Harald Welte

Patch Set 9:

We might not want to break existing command line users by removing the debug 
option completely. Is there a reasonable mapping from old levels to new?

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I30baac89f53e927f8699d0586b43cccf88ecd493
Gerrit-PatchSet: 9
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmo-trx[master]: osmo-trx: Drop cmd lines and use VTY cfg

2018-02-23 Thread Pau Espin Pedrol

Patch Set 5:

> I'm not sure we want to remove them. We might leave them for some
 > time to keep backwards compatibility to existing startup scripts
 > etc?

We are already breaking backwards compatibility in 6619 anyway since we require 
the config file to parse  it to init the VTY/logging parts. Furthermore, having 
both the parameters and the VTY at the same time seems really messy to me.

It may make sense to make a release before 6618 (depend on libosmocore), and 
then merge everything at once.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib8de1a5da4b3c0b6a49e00033f616e1d66656adf
Gerrit-PatchSet: 5
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


osmo-msc[master]: mcgp: let the MGW allocate the MGCP endpoint

2018-02-23 Thread Harald Welte

Patch Set 2: Code-Review-1

I would love to merge this, but without an updsate to the tests its not 
possible to merge.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iee3e446b6689626516f01c521abe3d4603cd3e13
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: dexter 
Gerrit-HasComments: No


osmo-trx[master]: vty: Implement VTY cfg parsing for current parameters

2018-02-23 Thread Pau Espin Pedrol

Patch Set 5:

> I don't think any of our vty has "on|off" so far. We have a
 > enable/disable or 0/1 ,(or cmd / no cmd). Let's not introduce even
 > more inconsistencies, please.

We have on/off for osmux for instance. But I can change it to other stuff if 
looks better to you, I have no preference.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie084c1b30b63f91c6e7640832ec1797d9e813832
Gerrit-PatchSet: 5
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


osmo-trx[master]: Logger: Use libosmocore logging system

2018-02-23 Thread Pau Espin Pedrol

Patch Set 9:

> We might not want to break existing command line users by removing
 > the debug option completely. Is there a reasonable mapping from old
 > levels to new?

Debug option? You mean -l DEBUG? Just use "logging level all debug" in VTY. 

Regarding mapping, all the levels used are the same except this one which is 
re-mapped since we have less levels:

#define LOGL_ALERT LOGL_FATAL
#define LOGL_WARNING LOGL_NOTICE

Other extra levels were not used in the code anyway.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I30baac89f53e927f8699d0586b43cccf88ecd493
Gerrit-PatchSet: 9
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[PATCH] osmo-gsm-tester[master]: contrib: build-osmo-trx: build new dep libosmocore

2018-02-23 Thread Pau Espin Pedrol

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

contrib: build-osmo-trx: build new dep libosmocore

Since 8b843e5bed6e3dab1068b86805e557a196f9aa4c, osmo-trx depends on
libosmocore.

Change-Id: I63d09339da5be7af638efe9e07f0c0ed31738ed1
---
M contrib/jenkins-build-osmo-trx.sh
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/47/6847/1

diff --git a/contrib/jenkins-build-osmo-trx.sh 
b/contrib/jenkins-build-osmo-trx.sh
index b996cfe..194266f 100755
--- a/contrib/jenkins-build-osmo-trx.sh
+++ b/contrib/jenkins-build-osmo-trx.sh
@@ -4,6 +4,7 @@
 name="osmo-trx"
 . "$(dirname "$0")/jenkins-build-common.sh"
 
+build_repo libosmocore --disable-doxygen
 build_repo osmo-trx --without-sse
 
 create_bin_tgz osmo-trx

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I63d09339da5be7af638efe9e07f0c0ed31738ed1
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 


osmo-trx[master]: osmo-trx: Drop cmd lines and use VTY cfg

2018-02-23 Thread Harald Welte

Patch Set 5:

> We are already breaking backwards compatibility in 6619 anyway
 > since we require the config file to parse  it to init the
 > VTY/logging parts. 

See my related comment on why not initialize the logging also with a 
translation of the command line argument

 > Furthermore, having both the parameters and the
 > VTY at the same time seems really messy to me.

That's what we had in osmocom projects like openbsc/osmo-nitb for a long time, 
and continue to have to some
extent.  Lots of things were command-line arguments in the past and have lateer 
been added to the VTY.

Unless it's a lot of effort to support both ways, I would prefer to have one 
release that supports both,
but will print related warnings during start-up if the legacy command line 
arguments are used, and then
remove it in the next release.  This gives people some time.  Also, it would 
open the possibility to
* start with command line arguments
* do "write file" to generate a config file from those old settings

Also, before we make any related release, we have to make sure all 
documentation is updated, from wiki to
user manuals, ...

 > It may make sense to make a release before 6618 (depend on
 > libosmocore), and then merge everything at once.

I guess that means reverting the change in master and applying all related 
patches to branch (via gerrit) first.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib8de1a5da4b3c0b6a49e00033f616e1d66656adf
Gerrit-PatchSet: 5
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


osmo-gsm-tester[master]: contrib: build-osmo-trx: build new dep libosmocore

2018-02-23 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I63d09339da5be7af638efe9e07f0c0ed31738ed1
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


osmo-trx[master]: vty: Implement VTY cfg parsing for current parameters

2018-02-23 Thread Harald Welte

Patch Set 5:

> > I don't think any of our vty has "on|off" so far. We have a
 > > enable/disable or 0/1 ,(or cmd / no cmd). Let's not introduce
 > even
 > > more inconsistencies, please.
 > 
 > We have on/off for osmux for instance. 

*sigh*.  Not sure how that slipped through the cracks at the time.  I really 
dislike
those inconsistencies.  They are a public sign of how sloppy we are :/

> But I can change it to other stuff if looks better to you, I have no 
> preference.

I think any method is better than the on|off

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie084c1b30b63f91c6e7640832ec1797d9e813832
Gerrit-PatchSet: 5
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


osmo-trx[master]: vty: Implement VTY cfg parsing for current parameters

2018-02-23 Thread Harald Welte

Patch Set 5:

(1 comment)

https://gerrit.osmocom.org/#/c/6650/5/CommonLibs/trx_vty.c
File CommonLibs/trx_vty.c:

Line 123:   "base-port <0-65535>",
port number '0' is not legal.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie084c1b30b63f91c6e7640832ec1797d9e813832
Gerrit-PatchSet: 5
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: Yes


[PATCH] osmo-bsc[master]: paging: page all bts when no cell is associated

2018-02-23 Thread dexter

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

paging: page all bts when no cell is associated

When the cell identifier list of the BSSMAP paging contains an
"No cell is associated with the transaction." entry then the
paging is dropped and no paging is started at all. This is not
correct. When no cell is associated, the BSS should page the
whole BSS instead.

- Replace respective error case with a paging request to all
  bts.

Change-Id: Id85e3a7540bdc13cd0e780e7870f16c35c6a6a50
---
M src/osmo-bsc/osmo_bsc_bssap.c
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index 156ebd3..573625e 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -524,8 +524,8 @@
 
switch (cell_ident) {
case CELL_IDENT_NO_CELL:
-   LOGP(DMSC, LOGL_NOTICE, "Ignoring no-op paging request for IMSI 
%s\n", mi_string);
-   return 0; /* nothing to do */
+   page_all_bts(msc, tmsi, mi_string, chan_needed);
+   break;
 
case CELL_IDENT_WHOLE_GLOBAL:
page_cgi(msc, data, data_length, remain, tmsi, mi_string, 
chan_needed);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id85e3a7540bdc13cd0e780e7870f16c35c6a6a50
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: dexter 


osmo-gsm-tester[master]: contrib: build-osmo-trx: build new dep libosmocore

2018-02-23 Thread Pau Espin Pedrol

Patch Set 1: Verified+1

I tested the build script locally, verifyng since anyway the gerrit job only 
tests runtime related stuff, not build (done by other jobs).

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I63d09339da5be7af638efe9e07f0c0ed31738ed1
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


[MERGED] osmo-gsm-tester[master]: contrib: build-osmo-trx: build new dep libosmocore

2018-02-23 Thread Pau Espin Pedrol
Pau Espin Pedrol has submitted this change and it was merged.

Change subject: contrib: build-osmo-trx: build new dep libosmocore
..


contrib: build-osmo-trx: build new dep libosmocore

Since 8b843e5bed6e3dab1068b86805e557a196f9aa4c, osmo-trx depends on
libosmocore.

Change-Id: I63d09339da5be7af638efe9e07f0c0ed31738ed1
---
M contrib/jenkins-build-osmo-trx.sh
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Pau Espin Pedrol: Verified
  Harald Welte: Looks good to me, approved



diff --git a/contrib/jenkins-build-osmo-trx.sh 
b/contrib/jenkins-build-osmo-trx.sh
index b996cfe..194266f 100755
--- a/contrib/jenkins-build-osmo-trx.sh
+++ b/contrib/jenkins-build-osmo-trx.sh
@@ -4,6 +4,7 @@
 name="osmo-trx"
 . "$(dirname "$0")/jenkins-build-common.sh"
 
+build_repo libosmocore --disable-doxygen
 build_repo osmo-trx --without-sse
 
 create_bin_tgz osmo-trx

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I63d09339da5be7af638efe9e07f0c0ed31738ed1
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Pau Espin Pedrol 


osmo-trx[master]: osmo-trx: Drop cmd lines and use VTY cfg

2018-02-23 Thread Pau Espin Pedrol

Patch Set 5:

> Unless it's a lot of effort to support both ways, I would prefer to
 > have one release that supports both,
 > but will print related warnings during start-up if the legacy
 > command line arguments are used, and then
 > remove it in the next release.  This gives people some time.  Also,
 > it would open the possibility to
 > * start with command line arguments
 > * do "write file" to generate a config file from those old settings
 > 

Ok, I'll try to modify this commit to use parameters to fill the trx_ctx 
structure and print a warning if any of the parameters is passed.

We still require to find a .cfg file in the path or through (-C), I guess 
that's fine.

On next release we can then drop the parameters and link -c to -C to read the 
config file (since -c is currently used for other purposes, and all osmo-* use 
-c to rad the config file).

 > Also, before we make any related release, we have to make sure all
 > documentation is updated, from wiki to
 > user manuals, ...

Agree.

 > 
 > > It may make sense to make a release before 6618 (depend on
 > > libosmocore), and then merge everything at once.
 > 
 > I guess that means reverting the change in master and applying all
 > related patches to branch (via gerrit) first.

To make things easier, maybe it's a good idea to release in the current state, 
that's it having a new dependency libosmocore but without affecting the current 
use of osmo-trx.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib8de1a5da4b3c0b6a49e00033f616e1d66656adf
Gerrit-PatchSet: 5
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


[PATCH] osmo-ttcn3-hacks[master]: bsc: fix testcase TC_paging_imsi_nochan

2018-02-23 Thread dexter

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

bsc: fix testcase TC_paging_imsi_nochan

The testcase TC_paging_imsi_nochan assumes that a paging for no
channel, with no specifc cell associated and without TMSI is
illegal. This is not correct. All these fields have legal values
and the TMSI field is optional.

- Replace the testcase implementation, use f_pageing_helper() to
  create the paging.

Change-Id: I6a56fb0ee06ae7e72a7ac2b6b058ad54f94127ab
---
M bsc/BSC_Tests.ttcn
1 file changed, 1 insertion(+), 25 deletions(-)


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

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index cc7294a..347380a 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -1007,31 +1007,7 @@
 testcase TC_paging_imsi_nochan() runs on test_CT {
var BSSMAP_FIELD_CellIdentificationList cid_list;
cid_list := valueof(ts_BSSMAP_CIL_noCell);
-   var integer i;
-
-   f_init();
-
-   /* Clear the queue, it might still contain stuff like BCCH FILLING */
-   for (i := 0; i < NUM_BTS; i := i + 1) {
-   IPA_RSL[i].clear;
-   }
-
-   f_bssap_tx_ud(ts_BSSMAP_Paging('001010123456789'H, cid_list, omit, 
omit));
-
-   /* wait for some time until when paging messages would appear */
-   f_sleep(3.0);
-
-   for (i := 0; i < NUM_BTS; i := i + 1) {
-   timer T := 0.01;
-   T.start;
-   alt {
-   [] IPA_RSL[i].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, 
tr_RSL_PAGING_CMD(?))) {
-   setverdict(fail, "Received unexpected paging");
-   }
-   [] T.timeout {}
-   }
-   }
-   setverdict(pass);
+   f_pageing_helper('00101010001'H, cid_list, c_BtsId_all, omit, omit);
 }
 
 /* PAGING by IMSI + TMSI */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a56fb0ee06ae7e72a7ac2b6b058ad54f94127ab
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: dexter 


[PATCH] osmo-bts[master]: osmo-bts-virtual: Make sure PRIM_INFO_MEAS have non-zero fra...

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

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

https://gerrit.osmocom.org/6678

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

osmo-bts-virtual: Make sure PRIM_INFO_MEAS have non-zero frame number

Measurement reports fed into L1SAP so far had their frame number always
set to zero, resulting in higher-layer common code aboe L1SAP to never
detect the end of the measurement period, which in turn caused no RSL
MEAS REP to be sent.

Related: OS#2978
Change-Id: I67837d19515ea335614928570c12dd5027104c6b
---
M src/osmo-bts-virtual/l1_if.c
1 file changed, 3 insertions(+), 2 deletions(-)


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

diff --git a/src/osmo-bts-virtual/l1_if.c b/src/osmo-bts-virtual/l1_if.c
index 01314fa..6904fe6 100644
--- a/src/osmo-bts-virtual/l1_if.c
+++ b/src/osmo-bts-virtual/l1_if.c
@@ -296,7 +296,7 @@
 
 
 static void l1if_fill_meas_res(struct osmo_phsap_prim *l1sap, uint8_t chan_nr, 
float ta,
-   float ber, float rssi)
+   float ber, float rssi, uint32_t fn)
 {
memset(l1sap, 0, sizeof(*l1sap));
osmo_prim_init(&l1sap->oph, SAP_GSM_PH, PRIM_MPH_INFO,
@@ -306,6 +306,7 @@
l1sap->u.info.u.meas_ind.ta_offs_qbits = (int16_t)(ta*4);
l1sap->u.info.u.meas_ind.ber10k = (unsigned int) (ber * 1);
l1sap->u.info.u.meas_ind.inv_rssi = (uint8_t) (rssi * -1);
+   l1sap->u.info.u.meas_ind.fn = fn;
 }
 
 static int l1if_process_meas_res(struct gsm_bts_trx *trx, uint8_t tn, uint32_t 
fn, uint8_t chan_nr,
@@ -321,7 +322,7 @@
gsm_lchan_name(lchan), chan_nr, 
ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
rssi, ber*100, n_errors, n_bits_total, lchan->meas.l1_info[1], 
lchan->rqd_ta, toa);
 
-   l1if_fill_meas_res(&l1sap, chan_nr, lchan->rqd_ta + toa, ber, rssi);
+   l1if_fill_meas_res(&l1sap, chan_nr, lchan->rqd_ta + toa, ber, rssi, fn);
 
return l1sap_up(trx, &l1sap);
 }

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

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


[PATCH] osmo-bts[master]: measurement.c: Hand Frame Number into measurement computation

2018-02-23 Thread Harald Welte

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

measurement.c: Hand Frame Number into measurement computation

This is currently only used for logging, but will be needed for proper
RX{LEV,QUAL}-SUB reporting in upcoming patches.

Related: OS#2978
Change-Id: I07fd06e8a379cab7c0c2eb111c3f5600037d3c9e
---
M include/osmo-bts/measurement.h
M src/common/l1sap.c
M src/common/measurement.c
3 files changed, 6 insertions(+), 6 deletions(-)


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

diff --git a/include/osmo-bts/measurement.h b/include/osmo-bts/measurement.h
index 47b31a2..e32c8e8 100644
--- a/include/osmo-bts/measurement.h
+++ b/include/osmo-bts/measurement.h
@@ -4,7 +4,7 @@
 #define MEAS_MAX_TIMING_ADVANCE 63
 #define MEAS_MIN_TIMING_ADVANCE 0
 
-int lchan_new_ul_meas(struct gsm_lchan *lchan, struct bts_ul_meas *ulm);
+int lchan_new_ul_meas(struct gsm_lchan *lchan, struct bts_ul_meas *ulm, 
uint32_t fn);
 
 int lchan_meas_check_compute(struct gsm_lchan *lchan, uint32_t fn);
 
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 01b454c..f6a04ea 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -529,7 +529,7 @@
/* we assume that symbol period is 1 bit: */
set_ms_to_data(lchan, info_meas_ind->ta_offs_qbits / 4, true);
 
-   lchan_new_ul_meas(lchan, &ulm);
+   lchan_new_ul_meas(lchan, &ulm, info_meas_ind->fn);
 
/* Check measurement period end and prepare the UL measurment
 * report at Meas period End*/
diff --git a/src/common/measurement.c b/src/common/measurement.c
index e4b8720..4e9a534 100644
--- a/src/common/measurement.c
+++ b/src/common/measurement.c
@@ -181,20 +181,20 @@
 }
 
 /* receive a L1 uplink measurement from L1 */
-int lchan_new_ul_meas(struct gsm_lchan *lchan, struct bts_ul_meas *ulm)
+int lchan_new_ul_meas(struct gsm_lchan *lchan, struct bts_ul_meas *ulm, 
uint32_t fn)
 {
-   DEBUGP(DMEAS, "%s adding measurement, num_ul_meas=%d\n",
+   DEBUGPFN(DMEAS, fn, "%s adding measurement, num_ul_meas=%d\n",
gsm_lchan_name(lchan), lchan->meas.num_ul_meas);
 
if (lchan->state != LCHAN_S_ACTIVE) {
-   LOGP(DMEAS, LOGL_NOTICE,
+   LOGPFN(DMEAS, LOGL_NOTICE, fn,
 "%s measurement during state: %s, num_ul_meas=%d\n",
 gsm_lchan_name(lchan), gsm_lchans_name(lchan->state),
 lchan->meas.num_ul_meas);
}
 
if (lchan->meas.num_ul_meas >= ARRAY_SIZE(lchan->meas.uplink)) {
-   LOGP(DMEAS, LOGL_NOTICE,
+   LOGPFN(DMEAS, LOGL_NOTICE, fn,
 "%s no space for uplink measurement, num_ul_meas=%d\n",
 gsm_lchan_name(lchan), lchan->meas.num_ul_meas);
return -ENOSPC;

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

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


[PATCH] osmo-bts[master]: split scheduler_mframe.c from scheduler.c

2018-02-23 Thread Harald Welte

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

split scheduler_mframe.c from scheduler.c

There are use cases for the multiframe scheduler tables outside the
context of the entire scheduler. Let's prepare for that.

Related: OS#2978
Change-Id: I6a501e66c47809ae3cdc55bef2cb6390ee0096b1
---
M include/osmo-bts/scheduler.h
M src/common/Makefile.am
M src/common/scheduler.c
A src/common/scheduler_mframe.c
4 files changed, 855 insertions(+), 816 deletions(-)


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

diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 11a30fd..4d34315 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -188,7 +188,37 @@
 /* \brief close all logical channels and reset timeslots */
 void trx_sched_reset(struct l1sched_trx *l1t);
 
+
+/* frame structures */
+struct trx_sched_frame {
+   /*! \brief downlink TRX channel type */
+   enum trx_chan_type  dl_chan;
+   /*! \brief downlink block ID */
+   uint8_t dl_bid;
+   /*! \brief uplink TRX channel type */
+   enum trx_chan_type  ul_chan;
+   /*! \brief uplink block ID */
+   uint8_t ul_bid;
+};
+
+/* multiframe structure */
+struct trx_sched_multiframe {
+   /*! \brief physical channel config (channel combination) */
+   enum gsm_phys_chan_config   pchan;
+   /*! \brief applies to which timeslots? */
+   uint8_t slotmask;
+   /*! \brief repeats how many frames */
+   uint8_t period;
+   /*! \brief pointer to scheduling structure */
+   const struct trx_sched_frame*frames;
+   /*! \brief human-readable name */
+   const char  *name;
+};
+
+int find_sched_mframe_idx(enum gsm_phys_chan_config pchan, uint8_t tn);
+
 /*! Determine if given frame number contains SACCH (true) or other (false) 
burst */
 bool trx_sched_is_sacch_fn(struct gsm_bts_trx_ts *ts, uint32_t fn, bool 
uplink);
+extern const struct trx_sched_multiframe trx_sched_multiframes[];
 
 #endif /* TRX_SCHEDULER_H */
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 67f3e80..113ff2f 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -12,6 +12,6 @@
   load_indication.c pcu_sock.c handover.c msg_utils.c \
   tx_power.c bts_ctrl_commands.c bts_ctrl_lookup.c \
   l1sap.c cbch.c power_control.c main.c phy_link.c \
-  dtx_dl_amr_fsm.c
+  dtx_dl_amr_fsm.c scheduler_mframe.c
 
 libl1sched_a_SOURCES = scheduler.c
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index 4e48160..0e24778 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -565,821 +565,6 @@
return rts_tch_common(l1t, tn, fn, chan, ((fn % 26) >> 2) & 1);
 }
 
-/*
- * multiframe structure
- */
-
-/* frame structures */
-struct trx_sched_frame {
-   /*! \brief downlink TRX channel type */
-   enum trx_chan_type  dl_chan;
-   /*! \brief downlink block ID */
-   uint8_t dl_bid;
-   /*! \brief uplink TRX channel type */
-   enum trx_chan_type  ul_chan;
-   /*! \brief uplink block ID */
-   uint8_t ul_bid;
-};
-
-static const struct trx_sched_frame frame_bcch[51] = {
-/* dl_chan dl_bid  ul_chan ul_bid */
-  {TRXC_FCCH,  0,  TRXC_RACH,  0 },
-  {TRXC_SCH,   0,  TRXC_RACH,  0 },
-  { TRXC_BCCH, 0,  TRXC_RACH,  0 }, { TRXC_BCCH,   1,  
TRXC_RACH,  0 }, { TRXC_BCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_BCCH,   3,  TRXC_RACH,  0 },
-  { TRXC_CCCH, 0,  TRXC_RACH,  0 }, { TRXC_CCCH,   1,  
TRXC_RACH,  0 }, { TRXC_CCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_CCCH,   3,  TRXC_RACH,  0 },
-  {TRXC_FCCH,  0,  TRXC_RACH,  0 },
-  {TRXC_SCH,   0,  TRXC_RACH,  0 },
-  { TRXC_CCCH, 0,  TRXC_RACH,  0 }, { TRXC_CCCH,   1,  
TRXC_RACH,  0 }, { TRXC_CCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_CCCH,   3,  TRXC_RACH,  0 },
-  { TRXC_CCCH, 0,  TRXC_RACH,  0 }, { TRXC_CCCH,   1,  
TRXC_RACH,  0 }, { TRXC_CCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_CCCH,   3,  TRXC_RACH,  0 },
-  {TRXC_FCCH,  0,  TRXC_RACH,  0 },
-  {TRXC_SCH,   0,  TRXC_RACH,  0 },
-  { TRXC_CCCH, 0,  TRXC_RACH,  0 }, { TRXC_CCCH,   1,  
TRXC_RACH,  0 }, { TRXC_CCCH,   2,  TRXC_RACH,  0 }, { 
TRXC_CCCH,   3,  TRXC_RACH,  0 },
-  { TRXC_CCCH, 0,  TRXC_RACH,  0 }, { TRXC_CCCH,   1,  
TRXC_RACH,  0 }, { TRXC_CCCH,   2,  TRXC_RACH, 

[PATCH] osmo-bts[master]: scheduler: add trx_sched_is_sacch_fn() function

2018-02-23 Thread Harald Welte

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

scheduler: add trx_sched_is_sacch_fn() function

For proper measurement processing of RX{LEV,QUAL}-SUB, we will
need this information.

Related: OS#2978
Change-Id: I768fde62452a74dce471ebf946e56eb1e4de1abc
---
M include/osmo-bts/scheduler.h
M src/common/scheduler.c
2 files changed, 43 insertions(+), 0 deletions(-)


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

diff --git a/include/osmo-bts/scheduler.h b/include/osmo-bts/scheduler.h
index 9dbc946..11a30fd 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -188,4 +188,7 @@
 /* \brief close all logical channels and reset timeslots */
 void trx_sched_reset(struct l1sched_trx *l1t);
 
+/*! Determine if given frame number contains SACCH (true) or other (false) 
burst */
+bool trx_sched_is_sacch_fn(struct gsm_bts_trx_ts *ts, uint32_t fn, bool 
uplink);
+
 #endif /* TRX_SCHEDULER_H */
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index 41b5d7a..4e48160 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -1340,6 +1340,46 @@
return -1;
 }
 
+/* Determine if given frame number contains SACCH (true) or other (false) 
burst */
+bool trx_sched_is_sacch_fn(struct gsm_bts_trx_ts *ts, uint32_t fn, bool uplink)
+{
+   int i;
+   const struct trx_sched_multiframe *sched;
+   const struct trx_sched_frame *frame;
+   enum trx_chan_type ch_type;
+
+   i = find_sched_mframe_idx(ts->pchan, ts->nr);
+   if (i < 0)
+   return -EINVAL;
+   sched = &trx_sched_multiframes[i];
+   frame = &sched->frames[fn % sched->period];
+   if (uplink)
+   ch_type = frame->ul_chan;
+   else
+   ch_type = frame->dl_chan;
+
+   switch (ch_type) {
+   case TRXC_SACCH4_0:
+   case TRXC_SACCH4_1:
+   case TRXC_SACCH4_2:
+   case TRXC_SACCH4_3:
+   case TRXC_SACCH8_0:
+   case TRXC_SACCH8_1:
+   case TRXC_SACCH8_2:
+   case TRXC_SACCH8_3:
+   case TRXC_SACCH8_4:
+   case TRXC_SACCH8_5:
+   case TRXC_SACCH8_6:
+   case TRXC_SACCH8_7:
+   case TRXC_SACCHTF:
+   case TRXC_SACCHTH_0:
+   case TRXC_SACCHTH_1:
+   return true;
+   default:
+   return false;
+   }
+}
+
 /* set multiframe scheduler to given pchan */
 int trx_sched_set_pchan(struct l1sched_trx *l1t, uint8_t tn,
enum gsm_phys_chan_config pchan)

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

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


[PATCH] osmo-bts[master]: scheduler.c: Factor out find_sched_mframe_idx() function

2018-02-23 Thread Harald Welte

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

scheduler.c: Factor out find_sched_mframe_idx() function

Let's split the look-up of the multiframe scheduler from the asignment
to a given l1ts in trx_sched_set_pchan.

Related: OS#2978
Change-Id: I79548b25aae647ce993a9d83c771d22b08cb1c74
---
M src/common/scheduler.c
1 file changed, 24 insertions(+), 17 deletions(-)


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

diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index efd7666..41b5d7a 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -1327,6 +1327,19 @@
  * scheduler functions
  */
 
+static int find_sched_mframe_idx(enum gsm_phys_chan_config pchan, uint8_t tn)
+{
+   int i;
+
+   for (i = 0; i < ARRAY_SIZE(trx_sched_multiframes); i++) {
+   if (trx_sched_multiframes[i].pchan == pchan
+&& (trx_sched_multiframes[i].slotmask & (1 << tn))) {
+   return i;
+   }
+   }
+   return -1;
+}
+
 /* set multiframe scheduler to given pchan */
 int trx_sched_set_pchan(struct l1sched_trx *l1t, uint8_t tn,
enum gsm_phys_chan_config pchan)
@@ -1334,24 +1347,18 @@
struct l1sched_ts *l1ts = l1sched_trx_get_ts(l1t, tn);
int i;
 
-   for (i = 0; i < ARRAY_SIZE(trx_sched_multiframes); i++) {
-   if (trx_sched_multiframes[i].pchan == pchan
-&& (trx_sched_multiframes[i].slotmask & (1 << tn))) {
-   l1ts->mf_index = i;
-   l1ts->mf_period = trx_sched_multiframes[i].period;
-   l1ts->mf_frames = trx_sched_multiframes[i].frames;
-   LOGP(DL1C, LOGL_NOTICE, "Configuring multiframe with "
-   "%s trx=%d ts=%d\n",
-   trx_sched_multiframes[i].name,
-   l1t->trx->nr, tn);
-   return 0;
-   }
+   i = find_sched_mframe_idx(pchan, tn);
+   if (i < 0) {
+   LOGP(DL1C, LOGL_NOTICE, "Failed to configure multiframe "
+   "trx=%d ts=%d\n", l1t->trx->nr, tn);
+   return -ENOTSUP;
}
-
-   LOGP(DL1C, LOGL_NOTICE, "Failed to configure multiframe "
-   "trx=%d ts=%d\n", l1t->trx->nr, tn);
-
-   return -ENOTSUP;
+   l1ts->mf_index = i;
+   l1ts->mf_period = trx_sched_multiframes[i].period;
+   l1ts->mf_frames = trx_sched_multiframes[i].frames;
+   LOGP(DL1C, LOGL_NOTICE, "Configuring multiframe with %s trx=%d ts=%d\n",
+   trx_sched_multiframes[i].name, l1t->trx->nr, tn);
+   return 0;
 }
 
 /* setting all logical channels given attributes to active/inactive */

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

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


[PATCH] osmo-bts[master]: l1sap: Pass is_sub from L1 primitive into the Uplink Measure...

2018-02-23 Thread Harald Welte

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

l1sap: Pass is_sub from L1 primitive into the Uplink Measurement

info_meas_ind on the L1SAP always allowed the lower layers to pass
in whether a given measurement is part of the "SUB", or not.

However, the existing l1sap code before this patch simply drops this
information, despite the measurement.c code also having "is_sub" state.

Let's make sure this state is passed from L1SAP into measurement
processing as intended.

Fact is, none of our current lower-layers actually set this is_sub flag
for their primitives passed up in L1SAP, but at least now *if* they
would set that flag, the measurement code would process it as intended.

Related: OS#2978
Change-Id: Ibed2e8d7563b471c6b5dd2214ac4765caf31ed2a
---
M src/common/l1sap.c
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index f6a04ea..3580a73 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -525,6 +525,7 @@
ulm.ta_offs_qbits = info_meas_ind->ta_offs_qbits;
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);

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

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


[PATCH] osmo-ttcn3-hacks[master]: bsc: fix TC_paging_imsi_a_reset

2018-02-23 Thread dexter

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

bsc: fix TC_paging_imsi_a_reset

The testcase TC_paging_imsi_a_reset sends a paging request that
causes pagings on all cells. Then it performs a BSSMAP reset and
checks if the paging has stopped. In order to be sure that paging
requests from before the reset procedure are not mistakenly
detected as after-reset-pagings the RSL queue is cleared. However
this is only done for IPA_RSL[0], which means IPA_RSL[1] and
IPA_RSL[2] still contain old paging requests, which lets the test
fail.

- Clear IPA_RSL[1] and IPA_RSL[2] as well.

Change-Id: If0cdc0325fd0e1dcf3e4ce52e4de27adb4d9cf48
---
M bsc/BSC_Tests.ttcn
1 file changed, 2 insertions(+), 0 deletions(-)


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

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 347380a..391a793 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -1199,6 +1199,8 @@
 
/* Clear the queue, it might still contain stuff like BCCH FILLING */
IPA_RSL[0].clear;
+   IPA_RSL[1].clear;
+   IPA_RSL[2].clear;
 
/* Wait for 3 seconds if any more PAGING CMD are received on RSL */
T.start;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If0cdc0325fd0e1dcf3e4ce52e4de27adb4d9cf48
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: dexter 


[PATCH] osmo-bts[master]: measurement: Compute RX{LEV, QUAL}-SUB for SDCCH and non-AMR TCH

2018-02-23 Thread Harald Welte

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

measurement: Compute RX{LEV,QUAL}-SUB for SDCCH and non-AMR TCH

The rules on how to compute RX{LEV,QUAL}-SUB are rather convoluted, and
depend on the detailed channel type and mode.

For SDCCH and TCH/H in signalling mode, it's easy: No DTX is allowed,
and all measurements are used in SUB.

For non-AMR (TCH/F and TCH/H in non-signalling mode), we need to count
the SACCH block measurements, as well as any
SID/SID_UPDATE/L3_FILL/DUMMY blocks received in the blocks of table
8.3 of TS 45.008.

Only AMR (TCH/AFS + TCH/AHS) are more difficult, as there are no fixed
blocks/bursts/frames that always contain uplink messages, but the L1
will have to determine if a valid SID_UPDATE was received or not.

This patch implements the above rules (except AMR related) in the common
part of OsmoBTS.  The AMR specific bits will have to follow as a later
patch, likely in a BTS specific way, i.e. separate changes to
sysmo/lc15/octphy/trx code.

Related: OS#2978
Change-Id: I16eb3747a1c23df935a4c50dafe46abce512a474
---
M src/common/measurement.c
1 file changed, 99 insertions(+), 3 deletions(-)


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

diff --git a/src/common/measurement.c b/src/common/measurement.c
index 4e9a534..1406fef 100644
--- a/src/common/measurement.c
+++ b/src/common/measurement.c
@@ -7,6 +7,97 @@
 #include 
 #include 
 #include 
+#include 
+
+/* Tables as per TS 45.008 Section 8.3 */
+static const uint8_t ts45008_83_tch_f[] = { 52, 53, 54, 55, 56, 57, 58, 59 };
+static const uint8_t ts45008_83_tch_hs0[] = { 0, 2, 4, 6, 52, 54, 56, 58 };
+static const uint8_t ts45008_83_tch_hs1[] = { 14, 16, 18, 29, 66, 68, 70, 72 };
+
+/* find out if an array contains a given key as element */
+#define ARRAY_CONTAINS(arr, val) array_contains(arr, ARRAY_SIZE(arr), val)
+static bool array_contains(const uint8_t *arr, unsigned int len, uint8_t val) {
+   int i;
+   for (i = 0; i < len; i++) {
+   if (arr[i] == val)
+   return true;
+   }
+   return false;
+}
+
+/* Decide if a given frame number is part of the "-SUB" measurements (true) or 
not (false) */
+static bool ts45008_83_is_sub(struct gsm_lchan *lchan, uint32_t fn, bool 
is_amr_sid_update)
+{
+   uint32_t fn104 = fn % 104;
+
+   /* See TS 45.008 Sections 8.3 and 8.4 for a detailed descriptions of 
the rules
+* implemented here. We only implement the logic for Voice, not CSD */
+
+   switch (lchan->type) {
+   case GSM_LCHAN_TCH_F:
+   switch (lchan->tch_mode) {
+   case GSM48_CMODE_SIGN:
+   case GSM48_CMODE_SPEECH_V1:
+   case GSM48_CMODE_SPEECH_EFR:
+   if (trx_sched_is_sacch_fn(lchan->ts, fn, true))
+   return true;
+   if (ARRAY_CONTAINS(ts45008_83_tch_f, fn104))
+   return true;
+   break;
+   case GSM48_CMODE_SPEECH_AMR:
+   if (trx_sched_is_sacch_fn(lchan->ts, fn, true))
+   return true;
+   if (is_amr_sid_update)
+   return true;
+   break;
+   default:
+   LOGPFN(DMEAS, LOGL_ERROR, fn, "%s: Unsupported 
lchan->tch_mode %u\n",
+   gsm_lchan_name(lchan), lchan->tch_mode);
+   break;
+   }
+   break;
+   case GSM_LCHAN_TCH_H:
+   switch (lchan->tch_mode) {
+   case GSM48_CMODE_SPEECH_V1:
+   if (trx_sched_is_sacch_fn(lchan->ts, fn, true))
+   return true;
+   switch (lchan->nr) {
+   case 0:
+   if (ARRAY_CONTAINS(ts45008_83_tch_hs0, fn104))
+   return true;
+   break;
+   case 1:
+   if (ARRAY_CONTAINS(ts45008_83_tch_hs1, fn104))
+   return true;
+   break;
+   default:
+   OSMO_ASSERT(0);
+   }
+   break;
+   case GSM48_CMODE_SPEECH_AMR:
+   if (trx_sched_is_sacch_fn(lchan->ts, fn, true))
+   return true;
+   if (is_amr_sid_update)
+   return true;
+   break;
+   case GSM48_CMODE_SIGN:
+   /* No DTX allowed; SUB=FULL, therefore measurements at 
all frame numbers are
+* SUB */
+   return true;
+   default:
+   LOGPFN(DMEAS, LOGL_ERROR, fn, "%s: Unsupported 
lchan->tch_mode %u\n",
+  

[PATCH] osmo-bts[master]: measurement.c: Don't silently copy "FULL" measurements to "SUB"

2018-02-23 Thread Harald Welte

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

measurement.c: Don't silently copy "FULL" measurements to "SUB"

The existing code contained an ugly hack that if we didn't have any
"SUB" measurements we would simply use the "FULL" values.  That's wrong
as TS 45.008 contains quite detailed rules on how the "SUB" values are
to be computed.  In some cases, they are identical to "FULL", but in
most they are not.

Let's remove the hack and replace it with an ERROR message, as clearly
something is wrong if we ever encounter a measurement period end in
which no single "SUB" measurement was received.  The only situation in
which this can occur is if the related uplink burst/block was missing,
so let's set BER to 100% and level to lowest possible.

Change-Id: I358f7b97fd4ea19264a77eff7abef13da7d5fbcd
---
M src/common/measurement.c
1 file changed, 5 insertions(+), 2 deletions(-)


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

diff --git a/src/common/measurement.c b/src/common/measurement.c
index 1406fef..85c5515 100644
--- a/src/common/measurement.c
+++ b/src/common/measurement.c
@@ -425,8 +425,11 @@
ber_sub_sum = ber_sub_sum / num_meas_sub;
irssi_sub_sum = irssi_sub_sum / num_meas_sub;
} else {
-   ber_sub_sum = ber_full_sum;
-   irssi_sub_sum = irssi_full_sum;
+   LOGP(DMEAS, LOGL_ERROR, "%s No measurements for SUB!!!\n", 
gsm_lchan_name(lchan));
+   /* The only situation in which this can occur is if the related 
uplink burst/block was
+* missing, so let's set BER to 100% and level to lowest 
possible. */
+   ber_sub_sum = 1; /* 100% */
+   irssi_sub_sum = 120; /* -120 dBm */
}
 
LOGP(DMEAS, LOGL_INFO, "%s Computed TA(% 4dqb) BER-FULL(%2u.%02u%%), 
RSSI-FULL(-%3udBm), "

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

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


osmo-bts[master]: scheduler: add trx_sched_is_sacch_fn() function

2018-02-23 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I768fde62452a74dce471ebf946e56eb1e4de1abc
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]: scheduler.c: Factor out find_sched_mframe_idx() function

2018-02-23 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I79548b25aae647ce993a9d83c771d22b08cb1c74
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]: osmo-bts-virtual: Make sure PRIM_INFO_MEAS have non-zero fra...

2018-02-23 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I67837d19515ea335614928570c12dd5027104c6b
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


osmo-bts[master]: measurement.c: Don't silently copy "FULL" measurements to "SUB"

2018-02-23 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-bts[master]: measurement.c: Hand Frame Number into measurement computation

2018-02-23 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I07fd06e8a379cab7c0c2eb111c3f5600037d3c9e
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]: l1sap: Pass is_sub from L1 primitive into the Uplink Measure...

2018-02-23 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibed2e8d7563b471c6b5dd2214ac4765caf31ed2a
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: Compute RX{LEV, QUAL}-SUB for SDCCH and non-AMR TCH

2018-02-23 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: bsc: fix TC_paging_imsi_a_reset

2018-02-23 Thread Harald Welte

Patch Set 1:

Nice catch!

n order to make the patch more future-proof, it would be better to iterate over 
the array using "for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1)".

This way, even if we have more than 3 BTSs in the future, the code will remain 
to work.

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

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


osmo-ttcn3-hacks[master]: bsc: fix testcase TC_paging_imsi_nochan

2018-02-23 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[MERGED] osmo-ttcn3-hacks[master]: bsc: fix testcase TC_paging_imsi_nochan

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

Change subject: bsc: fix testcase TC_paging_imsi_nochan
..


bsc: fix testcase TC_paging_imsi_nochan

The testcase TC_paging_imsi_nochan assumes that a paging for no
channel, with no specifc cell associated and without TMSI is
illegal. This is not correct. All these fields have legal values
and the TMSI field is optional.

- Replace the testcase implementation, use f_pageing_helper() to
  create the paging.

Change-Id: I6a56fb0ee06ae7e72a7ac2b6b058ad54f94127ab
---
M bsc/BSC_Tests.ttcn
1 file changed, 1 insertion(+), 25 deletions(-)

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



diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index cc7294a..347380a 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -1007,31 +1007,7 @@
 testcase TC_paging_imsi_nochan() runs on test_CT {
var BSSMAP_FIELD_CellIdentificationList cid_list;
cid_list := valueof(ts_BSSMAP_CIL_noCell);
-   var integer i;
-
-   f_init();
-
-   /* Clear the queue, it might still contain stuff like BCCH FILLING */
-   for (i := 0; i < NUM_BTS; i := i + 1) {
-   IPA_RSL[i].clear;
-   }
-
-   f_bssap_tx_ud(ts_BSSMAP_Paging('001010123456789'H, cid_list, omit, 
omit));
-
-   /* wait for some time until when paging messages would appear */
-   f_sleep(3.0);
-
-   for (i := 0; i < NUM_BTS; i := i + 1) {
-   timer T := 0.01;
-   T.start;
-   alt {
-   [] IPA_RSL[i].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, 
tr_RSL_PAGING_CMD(?))) {
-   setverdict(fail, "Received unexpected paging");
-   }
-   [] T.timeout {}
-   }
-   }
-   setverdict(pass);
+   f_pageing_helper('00101010001'H, cid_list, c_BtsId_all, omit, omit);
 }
 
 /* PAGING by IMSI + TMSI */

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

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


[PATCH] osmo-ttcn3-hacks[master]: bsc: fix TC_paging_imsi_a_reset

2018-02-23 Thread dexter
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6855

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

bsc: fix TC_paging_imsi_a_reset

The testcase TC_paging_imsi_a_reset sends a paging request that
causes pagings on all cells. Then it performs a BSSMAP reset and
checks if the paging has stopped. In order to be sure that paging
requests from before the reset procedure are not mistakenly
detected as after-reset-pagings the RSL queue is cleared. However
this is only done for IPA_RSL[0], which means IPA_RSL[1] and
IPA_RSL[2] still contain old paging requests, which lets the test
fail.

- Clear IPA_RSL[1] and IPA_RSL[2] as well.

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


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

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 347380a..7ba053a 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -1198,7 +1198,9 @@
}
 
/* Clear the queue, it might still contain stuff like BCCH FILLING */
-   IPA_RSL[0].clear;
+   for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) {
+   IPA_RSL[i].clear;
+   }
 
/* Wait for 3 seconds if any more PAGING CMD are received on RSL */
T.start;

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If0cdc0325fd0e1dcf3e4ce52e4de27adb4d9cf48
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-bts[master]: osmo-bts-virtual: Make sure PRIM_INFO_MEAS have non-zero fra...

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

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

https://gerrit.osmocom.org/6678

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

osmo-bts-virtual: Make sure PRIM_INFO_MEAS have non-zero frame number

Measurement reports fed into L1SAP so far had their frame number always
set to zero, resulting in higher-layer common code above L1SAP to never
detect the end of the measurement period, which in turn caused no RSL
MEAS REP to be sent.

Related: OS#2978
Change-Id: I67837d19515ea335614928570c12dd5027104c6b
---
M src/osmo-bts-virtual/l1_if.c
1 file changed, 3 insertions(+), 2 deletions(-)


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

diff --git a/src/osmo-bts-virtual/l1_if.c b/src/osmo-bts-virtual/l1_if.c
index 01314fa..6904fe6 100644
--- a/src/osmo-bts-virtual/l1_if.c
+++ b/src/osmo-bts-virtual/l1_if.c
@@ -296,7 +296,7 @@
 
 
 static void l1if_fill_meas_res(struct osmo_phsap_prim *l1sap, uint8_t chan_nr, 
float ta,
-   float ber, float rssi)
+   float ber, float rssi, uint32_t fn)
 {
memset(l1sap, 0, sizeof(*l1sap));
osmo_prim_init(&l1sap->oph, SAP_GSM_PH, PRIM_MPH_INFO,
@@ -306,6 +306,7 @@
l1sap->u.info.u.meas_ind.ta_offs_qbits = (int16_t)(ta*4);
l1sap->u.info.u.meas_ind.ber10k = (unsigned int) (ber * 1);
l1sap->u.info.u.meas_ind.inv_rssi = (uint8_t) (rssi * -1);
+   l1sap->u.info.u.meas_ind.fn = fn;
 }
 
 static int l1if_process_meas_res(struct gsm_bts_trx *trx, uint8_t tn, uint32_t 
fn, uint8_t chan_nr,
@@ -321,7 +322,7 @@
gsm_lchan_name(lchan), chan_nr, 
ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
rssi, ber*100, n_errors, n_bits_total, lchan->meas.l1_info[1], 
lchan->rqd_ta, toa);
 
-   l1if_fill_meas_res(&l1sap, chan_nr, lchan->rqd_ta + toa, ber, rssi);
+   l1if_fill_meas_res(&l1sap, chan_nr, lchan->rqd_ta + toa, ber, rssi, fn);
 
return l1sap_up(trx, &l1sap);
 }

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

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


osmo-ttcn3-hacks[master]: bsc: fix TC_paging_imsi_a_reset

2018-02-23 Thread dexter

Patch Set 1:

I have changed it now, but the altstep will still cover only three BTSs. Looks 
like there is no way to do this in a for-loop as well...

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

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


osmo-bts[master]: scheduler.c: Factor out find_sched_mframe_idx() function

2018-02-23 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I79548b25aae647ce993a9d83c771d22b08cb1c74
Gerrit-PatchSet: 1
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]: scheduler: add trx_sched_is_sacch_fn() function

2018-02-23 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I768fde62452a74dce471ebf946e56eb1e4de1abc
Gerrit-PatchSet: 1
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]: osmo-bts-virtual: Make sure PRIM_INFO_MEAS have non-zero fra...

2018-02-23 Thread Harald Welte

Patch Set 3: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I67837d19515ea335614928570c12dd5027104c6b
Gerrit-PatchSet: 3
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]: osmo-bts-virtual: Make sure PRIM_INFO_MEAS have non-zero fra...

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

Change subject: osmo-bts-virtual: Make sure PRIM_INFO_MEAS have non-zero frame 
number
..


osmo-bts-virtual: Make sure PRIM_INFO_MEAS have non-zero frame number

Measurement reports fed into L1SAP so far had their frame number always
set to zero, resulting in higher-layer common code above L1SAP to never
detect the end of the measurement period, which in turn caused no RSL
MEAS REP to be sent.

Related: OS#2978
Change-Id: I67837d19515ea335614928570c12dd5027104c6b
---
M src/osmo-bts-virtual/l1_if.c
1 file changed, 3 insertions(+), 2 deletions(-)

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



diff --git a/src/osmo-bts-virtual/l1_if.c b/src/osmo-bts-virtual/l1_if.c
index 01314fa..6904fe6 100644
--- a/src/osmo-bts-virtual/l1_if.c
+++ b/src/osmo-bts-virtual/l1_if.c
@@ -296,7 +296,7 @@
 
 
 static void l1if_fill_meas_res(struct osmo_phsap_prim *l1sap, uint8_t chan_nr, 
float ta,
-   float ber, float rssi)
+   float ber, float rssi, uint32_t fn)
 {
memset(l1sap, 0, sizeof(*l1sap));
osmo_prim_init(&l1sap->oph, SAP_GSM_PH, PRIM_MPH_INFO,
@@ -306,6 +306,7 @@
l1sap->u.info.u.meas_ind.ta_offs_qbits = (int16_t)(ta*4);
l1sap->u.info.u.meas_ind.ber10k = (unsigned int) (ber * 1);
l1sap->u.info.u.meas_ind.inv_rssi = (uint8_t) (rssi * -1);
+   l1sap->u.info.u.meas_ind.fn = fn;
 }
 
 static int l1if_process_meas_res(struct gsm_bts_trx *trx, uint8_t tn, uint32_t 
fn, uint8_t chan_nr,
@@ -321,7 +322,7 @@
gsm_lchan_name(lchan), chan_nr, 
ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power),
rssi, ber*100, n_errors, n_bits_total, lchan->meas.l1_info[1], 
lchan->rqd_ta, toa);
 
-   l1if_fill_meas_res(&l1sap, chan_nr, lchan->rqd_ta + toa, ber, rssi);
+   l1if_fill_meas_res(&l1sap, chan_nr, lchan->rqd_ta + toa, ber, rssi, fn);
 
return l1sap_up(trx, &l1sap);
 }

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

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


[MERGED] osmo-bts[master]: scheduler: add trx_sched_is_sacch_fn() function

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

Change subject: scheduler: add trx_sched_is_sacch_fn() function
..


scheduler: add trx_sched_is_sacch_fn() function

For proper measurement processing of RX{LEV,QUAL}-SUB, we will
need this information.

Related: OS#2978
Change-Id: I768fde62452a74dce471ebf946e56eb1e4de1abc
---
M include/osmo-bts/scheduler.h
M src/common/scheduler.c
2 files changed, 43 insertions(+), 0 deletions(-)

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/scheduler.h b/include/osmo-bts/scheduler.h
index 9dbc946..11a30fd 100644
--- a/include/osmo-bts/scheduler.h
+++ b/include/osmo-bts/scheduler.h
@@ -188,4 +188,7 @@
 /* \brief close all logical channels and reset timeslots */
 void trx_sched_reset(struct l1sched_trx *l1t);
 
+/*! Determine if given frame number contains SACCH (true) or other (false) 
burst */
+bool trx_sched_is_sacch_fn(struct gsm_bts_trx_ts *ts, uint32_t fn, bool 
uplink);
+
 #endif /* TRX_SCHEDULER_H */
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index 41b5d7a..4e48160 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -1340,6 +1340,46 @@
return -1;
 }
 
+/* Determine if given frame number contains SACCH (true) or other (false) 
burst */
+bool trx_sched_is_sacch_fn(struct gsm_bts_trx_ts *ts, uint32_t fn, bool uplink)
+{
+   int i;
+   const struct trx_sched_multiframe *sched;
+   const struct trx_sched_frame *frame;
+   enum trx_chan_type ch_type;
+
+   i = find_sched_mframe_idx(ts->pchan, ts->nr);
+   if (i < 0)
+   return -EINVAL;
+   sched = &trx_sched_multiframes[i];
+   frame = &sched->frames[fn % sched->period];
+   if (uplink)
+   ch_type = frame->ul_chan;
+   else
+   ch_type = frame->dl_chan;
+
+   switch (ch_type) {
+   case TRXC_SACCH4_0:
+   case TRXC_SACCH4_1:
+   case TRXC_SACCH4_2:
+   case TRXC_SACCH4_3:
+   case TRXC_SACCH8_0:
+   case TRXC_SACCH8_1:
+   case TRXC_SACCH8_2:
+   case TRXC_SACCH8_3:
+   case TRXC_SACCH8_4:
+   case TRXC_SACCH8_5:
+   case TRXC_SACCH8_6:
+   case TRXC_SACCH8_7:
+   case TRXC_SACCHTF:
+   case TRXC_SACCHTH_0:
+   case TRXC_SACCHTH_1:
+   return true;
+   default:
+   return false;
+   }
+}
+
 /* set multiframe scheduler to given pchan */
 int trx_sched_set_pchan(struct l1sched_trx *l1t, uint8_t tn,
enum gsm_phys_chan_config pchan)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I768fde62452a74dce471ebf946e56eb1e4de1abc
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 


[MERGED] osmo-bts[master]: scheduler.c: Factor out find_sched_mframe_idx() function

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

Change subject: scheduler.c: Factor out find_sched_mframe_idx() function
..


scheduler.c: Factor out find_sched_mframe_idx() function

Let's split the look-up of the multiframe scheduler from the asignment
to a given l1ts in trx_sched_set_pchan.

Related: OS#2978
Change-Id: I79548b25aae647ce993a9d83c771d22b08cb1c74
---
M src/common/scheduler.c
1 file changed, 24 insertions(+), 17 deletions(-)

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/src/common/scheduler.c b/src/common/scheduler.c
index efd7666..41b5d7a 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -1327,6 +1327,19 @@
  * scheduler functions
  */
 
+static int find_sched_mframe_idx(enum gsm_phys_chan_config pchan, uint8_t tn)
+{
+   int i;
+
+   for (i = 0; i < ARRAY_SIZE(trx_sched_multiframes); i++) {
+   if (trx_sched_multiframes[i].pchan == pchan
+&& (trx_sched_multiframes[i].slotmask & (1 << tn))) {
+   return i;
+   }
+   }
+   return -1;
+}
+
 /* set multiframe scheduler to given pchan */
 int trx_sched_set_pchan(struct l1sched_trx *l1t, uint8_t tn,
enum gsm_phys_chan_config pchan)
@@ -1334,24 +1347,18 @@
struct l1sched_ts *l1ts = l1sched_trx_get_ts(l1t, tn);
int i;
 
-   for (i = 0; i < ARRAY_SIZE(trx_sched_multiframes); i++) {
-   if (trx_sched_multiframes[i].pchan == pchan
-&& (trx_sched_multiframes[i].slotmask & (1 << tn))) {
-   l1ts->mf_index = i;
-   l1ts->mf_period = trx_sched_multiframes[i].period;
-   l1ts->mf_frames = trx_sched_multiframes[i].frames;
-   LOGP(DL1C, LOGL_NOTICE, "Configuring multiframe with "
-   "%s trx=%d ts=%d\n",
-   trx_sched_multiframes[i].name,
-   l1t->trx->nr, tn);
-   return 0;
-   }
+   i = find_sched_mframe_idx(pchan, tn);
+   if (i < 0) {
+   LOGP(DL1C, LOGL_NOTICE, "Failed to configure multiframe "
+   "trx=%d ts=%d\n", l1t->trx->nr, tn);
+   return -ENOTSUP;
}
-
-   LOGP(DL1C, LOGL_NOTICE, "Failed to configure multiframe "
-   "trx=%d ts=%d\n", l1t->trx->nr, tn);
-
-   return -ENOTSUP;
+   l1ts->mf_index = i;
+   l1ts->mf_period = trx_sched_multiframes[i].period;
+   l1ts->mf_frames = trx_sched_multiframes[i].frames;
+   LOGP(DL1C, LOGL_NOTICE, "Configuring multiframe with %s trx=%d ts=%d\n",
+   trx_sched_multiframes[i].name, l1t->trx->nr, tn);
+   return 0;
 }
 
 /* setting all logical channels given attributes to active/inactive */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I79548b25aae647ce993a9d83c771d22b08cb1c74
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 


[PATCH] osmo-gsm-tester[master]: modem: Identify modems by sysfs path instead of ofono dbus path

2018-02-23 Thread Pau Espin Pedrol

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

modem: Identify modems by sysfs path instead of ofono dbus path

ofono dbus paths are non-deterministic and can change over time for a
given modem. For instance when ofono is restartd or if a modem crashes
and the object is destroyed and re-announced by udev.

Requires at least ofono 1df92289d4e09a1e2db0b189b5153a4c238f98f1, which
implemented the feature to export the sysfs path to modem properties.

Related: OS#2509

Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201
---
M example/resources.conf
M src/osmo_gsm_tester/modem.py
2 files changed, 19 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/58/6858/1

diff --git a/example/resources.conf b/example/resources.conf
index ce370a6..fb2ac9f 100644
--- a/example/resources.conf
+++ b/example/resources.conf
@@ -67,16 +67,16 @@
 band: GSM-1900
 
 modem:
-- label: sierra_1
-  path: '/sierra_1'
+- label: sierra_1st
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.2'
   imsi: '90170009031'
   ki: '80A37E6FDEA931EAC92FFA5F671EFEAD'
   auth_algo: 'comp128v1'
   ciphers: [a5_0, a5_1]
   features: ['sms', 'voice', 'ussd', 'gprs']
 
-- label: sierra_2
-  path: '/sierra_2'
+- label: sierra_2nd
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.3'
   imsi: '90170009029'
   ki: '00969E283349D354A8239E877F2E0866'
   auth_algo: 'comp128v1'
@@ -84,7 +84,7 @@
   features: ['sms', 'voice', 'ussd', 'gprs']
 
 - label: ec20
-  path: '/gobi_0'
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.6'
   imsi: '90170009030'
   ki: 'BB70807226393CDBAC8DD3439FF54252'
   auth_algo: 'comp128v1'
@@ -92,7 +92,7 @@
   features: ['sms', 'ussd', 'gprs']
 
 - label: gobi2k
-  path: '/gobi_3'
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.5'
   imsi: '90170009032'
   ki: '2F70DCA43C45ACB97E947FDD0C7CA30A'
   auth_algo: 'comp128v1'
diff --git a/src/osmo_gsm_tester/modem.py b/src/osmo_gsm_tester/modem.py
index 5afd2d1..d37a358 100644
--- a/src/osmo_gsm_tester/modem.py
+++ b/src/osmo_gsm_tester/modem.py
@@ -92,6 +92,14 @@
 root = systembus_get('/')
 return sorted(root.GetModems())
 
+def get_modem_by_syspath(syspath):
+modems = list_modems()
+for modem in modems:
+if modem.get('SystemPath', '') == syspath:
+return modem
+raise ValueError('could not find %s in modem list: %s' % (syspath, modems))
+
+
 def _async_result_handler(obj, result, user_data):
 '''Generic callback dispatcher called from glib loop when an async method
 call has returned. This callback is set up by method dbus_async_call.'''
@@ -341,10 +349,12 @@
 
 def __init__(self, conf):
 self.conf = conf
-self.path = conf.get('path')
-super().__init__(log.C_TST, self.path)
+self.syspath = conf.get('path')
+self.dbuspath = get_modem_by_syspath(syspath)
+super().__init__(log.C_TST, self.dbuspath)
+self.dbg('creating from syspath %s', self.syspath)
 self.sms_received_list = []
-self.dbus = ModemDbusInteraction(self.path)
+self.dbus = ModemDbusInteraction(self.dbuspath)
 self.register_attempts = 0
 self.call_list = []
 # one Cancellable can handle several concurrent methods.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 


[PATCH] osmo-gsm-tester[master]: modem: Identify modems by sysfs path instead of ofono dbus path

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

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

https://gerrit.osmocom.org/6858

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

modem: Identify modems by sysfs path instead of ofono dbus path

ofono dbus paths are non-deterministic and can change over time for a
given modem. For instance when ofono is restartd or if a modem crashes
and the object is destroyed and re-announced by udev.

Requires at least ofono 1df92289d4e09a1e2db0b189b5153a4c238f98f1, which
implemented the feature to export the sysfs path to modem properties.

Related: OS#2509

Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201
---
M example/resources.conf
M src/osmo_gsm_tester/modem.py
2 files changed, 19 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/58/6858/2

diff --git a/example/resources.conf b/example/resources.conf
index ce370a6..fb2ac9f 100644
--- a/example/resources.conf
+++ b/example/resources.conf
@@ -67,16 +67,16 @@
 band: GSM-1900
 
 modem:
-- label: sierra_1
-  path: '/sierra_1'
+- label: sierra_1st
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.2'
   imsi: '90170009031'
   ki: '80A37E6FDEA931EAC92FFA5F671EFEAD'
   auth_algo: 'comp128v1'
   ciphers: [a5_0, a5_1]
   features: ['sms', 'voice', 'ussd', 'gprs']
 
-- label: sierra_2
-  path: '/sierra_2'
+- label: sierra_2nd
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.3'
   imsi: '90170009029'
   ki: '00969E283349D354A8239E877F2E0866'
   auth_algo: 'comp128v1'
@@ -84,7 +84,7 @@
   features: ['sms', 'voice', 'ussd', 'gprs']
 
 - label: ec20
-  path: '/gobi_0'
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.6'
   imsi: '90170009030'
   ki: 'BB70807226393CDBAC8DD3439FF54252'
   auth_algo: 'comp128v1'
@@ -92,7 +92,7 @@
   features: ['sms', 'ussd', 'gprs']
 
 - label: gobi2k
-  path: '/gobi_3'
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.5'
   imsi: '90170009032'
   ki: '2F70DCA43C45ACB97E947FDD0C7CA30A'
   auth_algo: 'comp128v1'
diff --git a/src/osmo_gsm_tester/modem.py b/src/osmo_gsm_tester/modem.py
index 5afd2d1..301fc29 100644
--- a/src/osmo_gsm_tester/modem.py
+++ b/src/osmo_gsm_tester/modem.py
@@ -92,6 +92,14 @@
 root = systembus_get('/')
 return sorted(root.GetModems())
 
+def get_modem_by_syspath(syspath):
+modems = list_modems()
+for modem in modems:
+if modem.get('SystemPath', '') == syspath:
+return modem
+raise ValueError('could not find %s in modem list: %s' % (syspath, modems))
+
+
 def _async_result_handler(obj, result, user_data):
 '''Generic callback dispatcher called from glib loop when an async method
 call has returned. This callback is set up by method dbus_async_call.'''
@@ -341,10 +349,12 @@
 
 def __init__(self, conf):
 self.conf = conf
-self.path = conf.get('path')
-super().__init__(log.C_TST, self.path)
+self.syspath = conf.get('path')
+self.dbuspath = get_modem_by_syspath(self.syspath)
+super().__init__(log.C_TST, self.dbuspath)
+self.dbg('creating from syspath %s', self.syspath)
 self.sms_received_list = []
-self.dbus = ModemDbusInteraction(self.path)
+self.dbus = ModemDbusInteraction(self.dbuspath)
 self.register_attempts = 0
 self.call_list = []
 # one Cancellable can handle several concurrent methods.

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201
Gerrit-PatchSet: 2
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-gsm-tester[master]: modem: Identify modems by sysfs path instead of ofono dbus path

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

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

https://gerrit.osmocom.org/6858

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

modem: Identify modems by sysfs path instead of ofono dbus path

ofono dbus paths are non-deterministic and can change over time for a
given modem. For instance when ofono is restartd or if a modem crashes
and the object is destroyed and re-announced by udev.

Requires at least ofono 1df92289d4e09a1e2db0b189b5153a4c238f98f1, which
implemented the feature to export the sysfs path to modem properties.

Related: OS#2509

Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201
---
M example/resources.conf
M src/osmo_gsm_tester/modem.py
2 files changed, 20 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/58/6858/3

diff --git a/example/resources.conf b/example/resources.conf
index ce370a6..fb2ac9f 100644
--- a/example/resources.conf
+++ b/example/resources.conf
@@ -67,16 +67,16 @@
 band: GSM-1900
 
 modem:
-- label: sierra_1
-  path: '/sierra_1'
+- label: sierra_1st
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.2'
   imsi: '90170009031'
   ki: '80A37E6FDEA931EAC92FFA5F671EFEAD'
   auth_algo: 'comp128v1'
   ciphers: [a5_0, a5_1]
   features: ['sms', 'voice', 'ussd', 'gprs']
 
-- label: sierra_2
-  path: '/sierra_2'
+- label: sierra_2nd
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.3'
   imsi: '90170009029'
   ki: '00969E283349D354A8239E877F2E0866'
   auth_algo: 'comp128v1'
@@ -84,7 +84,7 @@
   features: ['sms', 'voice', 'ussd', 'gprs']
 
 - label: ec20
-  path: '/gobi_0'
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.6'
   imsi: '90170009030'
   ki: 'BB70807226393CDBAC8DD3439FF54252'
   auth_algo: 'comp128v1'
@@ -92,7 +92,7 @@
   features: ['sms', 'ussd', 'gprs']
 
 - label: gobi2k
-  path: '/gobi_3'
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.5'
   imsi: '90170009032'
   ki: '2F70DCA43C45ACB97E947FDD0C7CA30A'
   auth_algo: 'comp128v1'
diff --git a/src/osmo_gsm_tester/modem.py b/src/osmo_gsm_tester/modem.py
index 5afd2d1..7c6a57d 100644
--- a/src/osmo_gsm_tester/modem.py
+++ b/src/osmo_gsm_tester/modem.py
@@ -92,6 +92,15 @@
 root = systembus_get('/')
 return sorted(root.GetModems())
 
+def get_modem_by_syspath(syspath):
+root = systembus_get('/')
+modems = root.GetModems()
+for modem in modems:
+if modem.get('SystemPath', '') == syspath:
+return modem
+raise ValueError('could not find %s in modem list: %s' % (syspath, modems))
+
+
 def _async_result_handler(obj, result, user_data):
 '''Generic callback dispatcher called from glib loop when an async method
 call has returned. This callback is set up by method dbus_async_call.'''
@@ -341,10 +350,12 @@
 
 def __init__(self, conf):
 self.conf = conf
-self.path = conf.get('path')
-super().__init__(log.C_TST, self.path)
+self.syspath = conf.get('path')
+self.dbuspath = get_modem_by_syspath(self.syspath)
+super().__init__(log.C_TST, self.dbuspath)
+self.dbg('creating from syspath %s', self.syspath)
 self.sms_received_list = []
-self.dbus = ModemDbusInteraction(self.path)
+self.dbus = ModemDbusInteraction(self.dbuspath)
 self.register_attempts = 0
 self.call_list = []
 # one Cancellable can handle several concurrent methods.

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201
Gerrit-PatchSet: 3
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-gsm-tester[master]: modem: Identify modems by sysfs path instead of ofono dbus path

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

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

https://gerrit.osmocom.org/6858

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

modem: Identify modems by sysfs path instead of ofono dbus path

ofono dbus paths are non-deterministic and can change over time for a
given modem. For instance when ofono is restartd or if a modem crashes
and the object is destroyed and re-announced by udev.

Requires at least ofono 1df92289d4e09a1e2db0b189b5153a4c238f98f1, which
implemented the feature to export the sysfs path to modem properties.

Related: OS#2509

Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201
---
M example/resources.conf
M src/osmo_gsm_tester/modem.py
2 files changed, 19 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/58/6858/4

diff --git a/example/resources.conf b/example/resources.conf
index ce370a6..fb2ac9f 100644
--- a/example/resources.conf
+++ b/example/resources.conf
@@ -67,16 +67,16 @@
 band: GSM-1900
 
 modem:
-- label: sierra_1
-  path: '/sierra_1'
+- label: sierra_1st
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.2'
   imsi: '90170009031'
   ki: '80A37E6FDEA931EAC92FFA5F671EFEAD'
   auth_algo: 'comp128v1'
   ciphers: [a5_0, a5_1]
   features: ['sms', 'voice', 'ussd', 'gprs']
 
-- label: sierra_2
-  path: '/sierra_2'
+- label: sierra_2nd
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.3'
   imsi: '90170009029'
   ki: '00969E283349D354A8239E877F2E0866'
   auth_algo: 'comp128v1'
@@ -84,7 +84,7 @@
   features: ['sms', 'voice', 'ussd', 'gprs']
 
 - label: ec20
-  path: '/gobi_0'
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.6'
   imsi: '90170009030'
   ki: 'BB70807226393CDBAC8DD3439FF54252'
   auth_algo: 'comp128v1'
@@ -92,7 +92,7 @@
   features: ['sms', 'ussd', 'gprs']
 
 - label: gobi2k
-  path: '/gobi_3'
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.5'
   imsi: '90170009032'
   ki: '2F70DCA43C45ACB97E947FDD0C7CA30A'
   auth_algo: 'comp128v1'
diff --git a/src/osmo_gsm_tester/modem.py b/src/osmo_gsm_tester/modem.py
index 5afd2d1..96b65d8 100644
--- a/src/osmo_gsm_tester/modem.py
+++ b/src/osmo_gsm_tester/modem.py
@@ -92,6 +92,14 @@
 root = systembus_get('/')
 return sorted(root.GetModems())
 
+def get_dbuspath_from_syspath(syspath):
+modems = list_modems()
+for dbuspath, props in modems:
+if props.get('SystemPath', '') == syspath:
+return dbuspath
+raise ValueError('could not find %s in modem list: %s' % (syspath, modems))
+
+
 def _async_result_handler(obj, result, user_data):
 '''Generic callback dispatcher called from glib loop when an async method
 call has returned. This callback is set up by method dbus_async_call.'''
@@ -341,10 +349,12 @@
 
 def __init__(self, conf):
 self.conf = conf
-self.path = conf.get('path')
-super().__init__(log.C_TST, self.path)
+self.syspath = conf.get('path')
+self.dbuspath = get_dbuspath_from_syspath(self.syspath)
+super().__init__(log.C_TST, self.dbuspath)
+self.dbg('creating from syspath %s', self.syspath)
 self.sms_received_list = []
-self.dbus = ModemDbusInteraction(self.path)
+self.dbus = ModemDbusInteraction(self.dbuspath)
 self.register_attempts = 0
 self.call_list = []
 # one Cancellable can handle several concurrent methods.

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201
Gerrit-PatchSet: 4
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder


osmo-gsm-tester[master]: modem: Identify modems by sysfs path instead of ofono dbus path

2018-02-23 Thread Pau Espin Pedrol

Patch Set 4: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201
Gerrit-PatchSet: 4
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


[MERGED] osmo-gsm-tester[master]: modem: Identify modems by sysfs path instead of ofono dbus path

2018-02-23 Thread Pau Espin Pedrol
Pau Espin Pedrol has submitted this change and it was merged.

Change subject: modem: Identify modems by sysfs path instead of ofono dbus path
..


modem: Identify modems by sysfs path instead of ofono dbus path

ofono dbus paths are non-deterministic and can change over time for a
given modem. For instance when ofono is restartd or if a modem crashes
and the object is destroyed and re-announced by udev.

Requires at least ofono 1df92289d4e09a1e2db0b189b5153a4c238f98f1, which
implemented the feature to export the sysfs path to modem properties.

Related: OS#2509

Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201
---
M example/resources.conf
M src/osmo_gsm_tester/modem.py
2 files changed, 19 insertions(+), 9 deletions(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/example/resources.conf b/example/resources.conf
index ce370a6..fb2ac9f 100644
--- a/example/resources.conf
+++ b/example/resources.conf
@@ -67,16 +67,16 @@
 band: GSM-1900
 
 modem:
-- label: sierra_1
-  path: '/sierra_1'
+- label: sierra_1st
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.2'
   imsi: '90170009031'
   ki: '80A37E6FDEA931EAC92FFA5F671EFEAD'
   auth_algo: 'comp128v1'
   ciphers: [a5_0, a5_1]
   features: ['sms', 'voice', 'ussd', 'gprs']
 
-- label: sierra_2
-  path: '/sierra_2'
+- label: sierra_2nd
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.3'
   imsi: '90170009029'
   ki: '00969E283349D354A8239E877F2E0866'
   auth_algo: 'comp128v1'
@@ -84,7 +84,7 @@
   features: ['sms', 'voice', 'ussd', 'gprs']
 
 - label: ec20
-  path: '/gobi_0'
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.6'
   imsi: '90170009030'
   ki: 'BB70807226393CDBAC8DD3439FF54252'
   auth_algo: 'comp128v1'
@@ -92,7 +92,7 @@
   features: ['sms', 'ussd', 'gprs']
 
 - label: gobi2k
-  path: '/gobi_3'
+  path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.5'
   imsi: '90170009032'
   ki: '2F70DCA43C45ACB97E947FDD0C7CA30A'
   auth_algo: 'comp128v1'
diff --git a/src/osmo_gsm_tester/modem.py b/src/osmo_gsm_tester/modem.py
index 5afd2d1..96b65d8 100644
--- a/src/osmo_gsm_tester/modem.py
+++ b/src/osmo_gsm_tester/modem.py
@@ -92,6 +92,14 @@
 root = systembus_get('/')
 return sorted(root.GetModems())
 
+def get_dbuspath_from_syspath(syspath):
+modems = list_modems()
+for dbuspath, props in modems:
+if props.get('SystemPath', '') == syspath:
+return dbuspath
+raise ValueError('could not find %s in modem list: %s' % (syspath, modems))
+
+
 def _async_result_handler(obj, result, user_data):
 '''Generic callback dispatcher called from glib loop when an async method
 call has returned. This callback is set up by method dbus_async_call.'''
@@ -341,10 +349,12 @@
 
 def __init__(self, conf):
 self.conf = conf
-self.path = conf.get('path')
-super().__init__(log.C_TST, self.path)
+self.syspath = conf.get('path')
+self.dbuspath = get_dbuspath_from_syspath(self.syspath)
+super().__init__(log.C_TST, self.dbuspath)
+self.dbg('creating from syspath %s', self.syspath)
 self.sms_received_list = []
-self.dbus = ModemDbusInteraction(self.path)
+self.dbus = ModemDbusInteraction(self.dbuspath)
 self.register_attempts = 0
 self.call_list = []
 # one Cancellable can handle several concurrent methods.

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201
Gerrit-PatchSet: 4
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 


[PATCH] osmo-gsm-tester[master]: pcap_recorder: log printing pcap file name as dbg

2018-02-23 Thread Pau Espin Pedrol

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

pcap_recorder: log printing pcap file name as dbg

The log message is quite long and makes it difficult to read the log
even with debug disabled.

Change-Id: I593c0ce02bf7a3a9d26cf1fcc7d523a313cb72eb
---
M src/osmo_gsm_tester/pcap_recorder.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/59/6859/1

diff --git a/src/osmo_gsm_tester/pcap_recorder.py 
b/src/osmo_gsm_tester/pcap_recorder.py
index 398ec6c..98dea8b 100644
--- a/src/osmo_gsm_tester/pcap_recorder.py
+++ b/src/osmo_gsm_tester/pcap_recorder.py
@@ -37,7 +37,7 @@
 self.start()
 
 def start(self):
-self.log('Recording pcap', self.run_dir, self.filters)
+self.dbg('Recording pcap', self.run_dir, self.filters)
 dumpfile = os.path.join(os.path.abspath(self.run_dir), self.name() + 
".pcap")
 self.process = process.Process(self.name(), self.run_dir,
('tcpdump', '-n',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I593c0ce02bf7a3a9d26cf1fcc7d523a313cb72eb
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 


[PATCH] osmo-bsc[master]: paging: fix paging attemt rate counter

2018-02-23 Thread dexter

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

paging: fix paging attemt rate counter

The rate counter BSC_CTR_PAGING_ATTEMPTED does not increment when
a paging request is sent to the BSC. The reson for this is that the
function call to rate_ctr_inc() is located in a dead code section.

- Move the function call to rate_ctr_inc() to osmo_bsc_bssmap.c.
  incremanet on any paging attempt (valid or not) that is recived
  on the A-Interface.

- Remove dead code from paging.c

Change-Id: Iec3eb6724bc655806c3ce3c28448069590d99f91
---
M src/libbsc/paging.c
M src/osmo-bsc/osmo_bsc_bssap.c
2 files changed, 3 insertions(+), 38 deletions(-)


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

diff --git a/src/libbsc/paging.c b/src/libbsc/paging.c
index 825d31e..43532d1 100644
--- a/src/libbsc/paging.c
+++ b/src/libbsc/paging.c
@@ -345,44 +345,6 @@
return 1;
 }
 
-/*! Receive a new PAGING request from the MSC
- * \param network gsm_network we operate in
- * \param[in] bsub subscriber we want to page
- * \param[in] type type of radio channel we're requirign
- * \param[in] msc MSC which has issue this paging
- * \returns number of BTSs on which we issued the paging */
-int paging_request(struct gsm_network *network, struct bsc_subscr *bsub, int 
type,
-  struct bsc_msc_data *msc)
-{
-   struct gsm_bts *bts = NULL;
-   int num_pages = 0;
-
-   rate_ctr_inc(&network->bsc_ctrs->ctr[BSC_CTR_PAGING_ATTEMPTED]);
-
-   /* start paging subscriber on all BTS within Location Area */
-   do {
-   int rc;
-
-   bts = gsm_bts_by_lac(network, bsub->lac, bts);
-   if (!bts)
-   break;
-
-   rc = paging_request_bts(bts, bsub, type, msc);
-   if (rc < 0) {
-   paging_request_stop(&network->bts_list, NULL, bsub,
-   NULL, NULL);
-   return rc;
-   }
-   num_pages += rc;
-   } while (1);
-
-   if (num_pages == 0)
-   rate_ctr_inc(&network->bsc_ctrs->ctr[BSC_CTR_PAGING_DETACHED]);
-
-   return num_pages;
-}
-
-
 /*! Stop paging a given subscriber on a given BTS.
  *  If \a conn is non-NULL, we also call the paging call-back function
  *  to notify the paging originator that paging has completed.
diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index 573625e..17a72d4 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -459,6 +459,9 @@
uint8_t chan_needed = RSL_CHANNEED_ANY;
uint8_t cell_ident;
 
+   /* Any received BSSMAP paging will count as a paging attempt */
+   rate_ctr_inc(&msc->network->bsc_ctrs->ctr[BSC_CTR_PAGING_ATTEMPTED]);
+
tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l4h + 1, payload_length - 1, 
0, 0);
remain = payload_length - 1;
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iec3eb6724bc655806c3ce3c28448069590d99f91
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: dexter 


[PATCH] osmo-bsc[master]: bsc_api: drop unknown RR messages.

2018-02-23 Thread dexter

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

bsc_api: drop unknown RR messages.

Radio Resource (RR) handling is entirely done inside the BSC. However,
the current implementation forwards unknown RR messages to the MSC.
This is not compliant to the specification.

- Remove the forwarding and drop any unknown RR message.

Change-Id: I0a4d311f6939a4fcee59129daa18da4a2ab510ae
---
M src/libbsc/bsc_api.c
1 file changed, 2 insertions(+), 6 deletions(-)


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

diff --git a/src/libbsc/bsc_api.c b/src/libbsc/bsc_api.c
index 2dc7b9a..1dbda78 100644
--- a/src/libbsc/bsc_api.c
+++ b/src/libbsc/bsc_api.c
@@ -773,14 +773,10 @@
api->dtap(conn, link_id, msg);
break;
default:
-   /* Normally, a MSC should never receive RR
-* messages, but we'd rather forward what we
-* don't know than drop it... */
+   /* Drop unknown RR message */
LOGP(DRR, LOGL_NOTICE,
-"BSC: Passing %s 04.08 RR message to MSC\n",
+"BSC: Dropping %s 04.08 RR message\n",
 gsm48_rr_msg_name(msg_type));
-   if (api->dtap)
-   api->dtap(conn, link_id, msg);
}
break;
default:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0a4d311f6939a4fcee59129daa18da4a2ab510ae
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: dexter 


osmo-gsm-tester[master]: pcap_recorder: log printing pcap file name as dbg

2018-02-23 Thread Pau Espin Pedrol

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I593c0ce02bf7a3a9d26cf1fcc7d523a313cb72eb
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


[MERGED] osmo-gsm-tester[master]: pcap_recorder: log printing pcap file name as dbg

2018-02-23 Thread Pau Espin Pedrol
Pau Espin Pedrol has submitted this change and it was merged.

Change subject: pcap_recorder: log printing pcap file name as dbg
..


pcap_recorder: log printing pcap file name as dbg

The log message is quite long and makes it difficult to read the log
even with debug disabled.

Change-Id: I593c0ce02bf7a3a9d26cf1fcc7d523a313cb72eb
---
M src/osmo_gsm_tester/pcap_recorder.py
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_gsm_tester/pcap_recorder.py 
b/src/osmo_gsm_tester/pcap_recorder.py
index 398ec6c..98dea8b 100644
--- a/src/osmo_gsm_tester/pcap_recorder.py
+++ b/src/osmo_gsm_tester/pcap_recorder.py
@@ -37,7 +37,7 @@
 self.start()
 
 def start(self):
-self.log('Recording pcap', self.run_dir, self.filters)
+self.dbg('Recording pcap', self.run_dir, self.filters)
 dumpfile = os.path.join(os.path.abspath(self.run_dir), self.name() + 
".pcap")
 self.process = process.Process(self.name(), self.run_dir,
('tcpdump', '-n',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I593c0ce02bf7a3a9d26cf1fcc7d523a313cb72eb
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 


[PATCH] osmo-ttcn3-hacks[master]: BSC: Add CCHAN_PT recently introduced in RSL_Emulation

2018-02-23 Thread Harald Welte

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

BSC: Add CCHAN_PT recently introduced in RSL_Emulation

RSL_Emulation has recently gained a port for the common channel
management messages, but BSC_Tests was not updated with this port,
resulting in RSL_Emulation enqueuing messages to the port which then
creates dynamic test case failures.

Let's simply connect to the port, even though we currently are not
interested in any of the messages received there (mainly
RSL_MT_BCCH_INFO during startup).

Change-Id: Id8a3c4409599783ca4cd0b49f2570bcb3bb34952
---
M bsc/BSC_Tests.ttcn
1 file changed, 3 insertions(+), 0 deletions(-)


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

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index cc7294a..d602771 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -63,6 +63,8 @@
 type component test_CT extends CTRL_Adapter_CT {
/* Array of per-BTS state */
var BTS_State bts[NUM_BTS];
+   /* RSL common Channel Port (for RSL_Emulation) */
+   port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS];
/* array of per-BTS RSL test ports */
port IPA_RSL_PT IPA_RSL[NUM_BTS];
port IPA_CODEC_PT IPA; /* Required for compilation of 
TC_rsl_unknown_unit_id() */
@@ -154,6 +156,7 @@
clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0";
if (handler_mode) {
clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL");
+   connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]);
}
 
map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT);

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

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


[PATCH] osmo-ttcn3-hacks[master]: RSL: Add definitions for RSL MEAS REP parsing/encoding

2018-02-23 Thread Harald Welte

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

RSL: Add definitions for RSL MEAS REP parsing/encoding

Change-Id: Ib04b81891def2c15a62767a29b53c0fb605d45be
---
M library/RSL_Types.ttcn
1 file changed, 32 insertions(+), 0 deletions(-)


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

diff --git a/library/RSL_Types.ttcn b/library/RSL_Types.ttcn
index b1716fd..c9fcfab 100644
--- a/library/RSL_Types.ttcn
+++ b/library/RSL_Types.ttcn
@@ -423,6 +423,19 @@
frame_nr := tr_RSL_IE_FrameNumber(frame_nr)
}
 
+   /* 9.3.25 */
+   type record RSL_IE_UplinkMeas {
+   uint8_t len,
+   BIT1 rfu,
+   boolean dtx_d,
+   uint6_t rxlev_f_u,
+   BIT2 reserved1,
+   uint6_t rxlev_s_u,
+   BIT2 reserved2,
+   uint3_t rxq_f_u,
+   uint3_t rxq_s_u,
+   octetstring supp_meas_info optional
+   } with { variant (len) 
"LENGTHTO(rfu,dtx_d,rxlev_f_u,reserved1,rxlev_s_u,reserved2,rxq_f_u,rxq_s_u,supp_meas_info)"
 };
 
/* 9.3.26 */
type enumerated RSL_Cause {
@@ -589,6 +602,8 @@
uint8_t access_delay,
RSL_IE_RachLoad rach_load,
uint8_t meas_res_nr,
+   uint8_t ms_timing_offset,
+   RSL_IE_UplinkMeas   uplink_meas,
RSL_IE_L1Info   l1_info,
RSL_IE_SysinfoType  sysinfo_type,
uint16_tpaging_load,
@@ -635,6 +650,8 @@
access_delay, iei = RSL_IE_ACCESS_DELAY;
rach_load, iei = RSL_IE_RACH_LOAD;
meas_res_nr, iei = RSL_IE_MEAS_RES_NR;
+   ms_timing_offset, iei = 
RSL_IE_MS_TIMING_OFFSET;
+   uplink_meas, iei = RSL_IE_UPLINK_MEAS;
l1_info, iei = RSL_IE_L1_INFO;
sysinfo_type, iei = RSL_IE_SYSINFO_TYPE;
paging_load, iei = RSL_IE_PAGING_LOAD;
@@ -1007,6 +1024,21 @@
}
}
 
+   template RSL_Message tr_RSL_MEAS_RES(template RslChannelNr chan_nr,
+template uint8_t meas_res_nr := ?,
+template RSL_IE_UplinkMeas ul_meas 
:= ?,
+template RSL_IE_BS_Power bs_power 
:= ?) := {
+   msg_disc := ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),
+   msg_type := RSL_MT_MEAS_RES,
+   ies := {
+   tr_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr}),
+   tr_RSL_IE(RSL_IE_Body:{meas_res_nr := meas_res_nr}),
+   tr_RSL_IE(RSL_IE_Body:{uplink_meas := ul_meas}),
+   tr_RSL_IE(RSL_IE_Body:{bs_power := bs_power}),
+   *
+   }
+   }
+
/* 8.4.10 BTS -> BSC */
template RSL_Message ts_RSL_MODE_MODIFY_ACK(RslChannelNr chan_nr) := {
msg_disc := ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),

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

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


[PATCH] osmo-ttcn3-hacks[master]: GSM_RR_Types: Fix inverted "valid" logic in measurement report

2018-02-23 Thread Harald Welte

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

GSM_RR_Types: Fix inverted "valid" logic in measurement report

Change-Id: I3ebdd30639b45ba1a9c0fbda7bf2775035833300
---
M library/GSM_RR_Types.ttcn
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/library/GSM_RR_Types.ttcn b/library/GSM_RR_Types.ttcn
index 2625a1f..4d1efd7 100644
--- a/library/GSM_RR_Types.ttcn
+++ b/library/GSM_RR_Types.ttcn
@@ -695,7 +695,7 @@
dtx_used := '0'B,
rxlev_full_srv_cell := rxl_f,
threeg_ba_used := '0'B,
-   meas_valid := bool2bit(valid),
+   meas_valid := bool2bit(not valid),
rxlev_sub_srv_cell := rxl_s,
si23_ba_used := '0'B,
rxqual_full_srv_cell := rxq_f,

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

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


[PATCH] osmo-ttcn3-hacks[master]: RSL_Types: Add tr_RSL_MEAS_RES_OSMO()

2018-02-23 Thread Harald Welte

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

RSL_Types: Add tr_RSL_MEAS_RES_OSMO()

This is a template that goes beyond the 3GPP specs, as it expects
presence of certain optional IEs which we know are always present
in the OsmoBTS case.

Change-Id: Ibf37565ab4fe70515b598a2757953628aa780241
---
M library/RSL_Types.ttcn
1 file changed, 22 insertions(+), 0 deletions(-)


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

diff --git a/library/RSL_Types.ttcn b/library/RSL_Types.ttcn
index c9fcfab..2cd5bd5 100644
--- a/library/RSL_Types.ttcn
+++ b/library/RSL_Types.ttcn
@@ -1039,6 +1039,28 @@
}
}
 
+   /* Osmocom specific template, require lots of optional fields to be 
present */
+   template RSL_Message tr_RSL_MEAS_RES_OSMO(template RslChannelNr chan_nr,
+template uint8_t meas_res_nr := ?,
+template RSL_IE_UplinkMeas ul_meas 
:= ?,
+template RSL_IE_BS_Power bs_power 
:= ?,
+template RSL_IE_L1Info l1_info := 
?,
+template octetstring l3_info := ?,
+template uint8_t ms_to := ?) := {
+   msg_disc := ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),
+   msg_type := RSL_MT_MEAS_RES,
+   ies := {
+   tr_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr}),
+   tr_RSL_IE(RSL_IE_Body:{meas_res_nr := meas_res_nr}),
+   tr_RSL_IE(RSL_IE_Body:{uplink_meas := ul_meas}),
+   tr_RSL_IE(RSL_IE_Body:{bs_power := bs_power}),
+   tr_RSL_IE(RSL_IE_Body:{l1_info := l1_info}),
+   tr_RSL_IE(RSL_IE_Body:{l3_info := 
tr_RSL_L16V(l3_info)}),
+   tr_RSL_IE(RSL_IE_Body:{ms_timing_offset := ms_to})
+   }
+   }
+
+
/* 8.4.10 BTS -> BSC */
template RSL_Message ts_RSL_MODE_MODIFY_ACK(RslChannelNr chan_nr) := {
msg_disc := ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),

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

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


[PATCH] osmo-ttcn3-hacks[master]: L1CTL: Increase FBSB timeout to ~1s

2018-02-23 Thread Harald Welte

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

L1CTL: Increase FBSB timeout to ~1s

Change-Id: Id2bb23ae966bd9aa5fc36bfa8ba41d7f136ac88f
---
M library/L1CTL_Types.ttcn
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/library/L1CTL_Types.ttcn b/library/L1CTL_Types.ttcn
index d49f37d..f9b4fe8 100644
--- a/library/L1CTL_Types.ttcn
+++ b/library/L1CTL_Types.ttcn
@@ -366,7 +366,7 @@
payload := {
fbsb_req := {
arfcn := arfcn,
-   timeout_tdma_frames := 10,
+   timeout_tdma_frames := 250, /* about 1s */
freq_err_thresh1 := 1,
freq_err_thresh2 := 800,
num_freqerr_avg := 3,

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

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


osmo-ttcn3-hacks[master]: GSM_RR_Types: Fix inverted "valid" logic in measurement report

2018-02-23 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3ebdd30639b45ba1a9c0fbda7bf2775035833300
Gerrit-PatchSet: 1
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: Quickly fail in case of non-successful FBSB.resp

2018-02-23 Thread Harald Welte

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

L1CTL: Quickly fail in case of non-successful FBSB.resp

Change-Id: I9d1fdb196eee7b3b06f2d3622e59d58f402dcd0d
---
M library/L1CTL_PortType.ttcn
1 file changed, 3 insertions(+), 0 deletions(-)


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

diff --git a/library/L1CTL_PortType.ttcn b/library/L1CTL_PortType.ttcn
index dd5abc9..b82419e 100644
--- a/library/L1CTL_PortType.ttcn
+++ b/library/L1CTL_PortType.ttcn
@@ -26,6 +26,9 @@
T.start
alt {
[] pt.receive(t_L1CTL_FBSB_CONF(0)) {};
+   [] pt.receive(t_L1CTL_FBSB_CONF(?)) {
+   setverdict(fail, "FBSB Failed with non-zero 
return code");
+   };
[] pt.receive { repeat; };
[] T.timeout { setverdict(fail, "Timeout in FBSB") };
}

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

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


osmo-ttcn3-hacks[master]: RSL: Add definitions for RSL MEAS REP parsing/encoding

2018-02-23 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib04b81891def2c15a62767a29b53c0fb605d45be
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


osmo-ttcn3-hacks[master]: L1CTL: Increase FBSB timeout to ~1s

2018-02-23 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id2bb23ae966bd9aa5fc36bfa8ba41d7f136ac88f
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


osmo-ttcn3-hacks[master]: RSL_Types: Add tr_RSL_MEAS_RES_OSMO()

2018-02-23 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibf37565ab4fe70515b598a2757953628aa780241
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


osmo-ttcn3-hacks[master]: L1CTL: Quickly fail in case of non-successful FBSB.resp

2018-02-23 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I9d1fdb196eee7b3b06f2d3622e59d58f402dcd0d
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


osmo-bsc[master]: bsc_api: drop unknown RR messages.

2018-02-23 Thread Harald Welte

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/6861/1/src/libbsc/bsc_api.c
File src/libbsc/bsc_api.c:

Line 778:"BSC: Dropping %s 04.08 RR message\n",
I think yo want the lchan->name or some other identity/context of the 
subscr-conn on *where* that message was received before it got dropped?


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0a4d311f6939a4fcee59129daa18da4a2ab510ae
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: Yes


osmo-bsc[master]: paging: fix paging attemt rate counter

2018-02-23 Thread Harald Welte

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/6860/1/src/osmo-bsc/osmo_bsc_bssap.c
File src/osmo-bsc/osmo_bsc_bssap.c:

Line 463:   
rate_ctr_inc(&msc->network->bsc_ctrs->ctr[BSC_CTR_PAGING_ATTEMPTED]);
it's called PAGING_ATTEMPTED and we should only increment it if we actually 
have attempted paging.  If mandatory IEs ar emissing (see below), we didn't 
attempt anything.

Moving it just above the "switch (cell_ident)" makes sense.  There's still some 
code paths below where we might fail before attempting to page, but I guess 
this location is a good compromise: Keep counter incremenet in shared code (and 
thus only called once) but avoid increments in the most obvious error paths.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iec3eb6724bc655806c3ce3c28448069590d99f91
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: Yes


[MERGED] osmo-ttcn3-hacks[master]: RSL_Types: Add tr_RSL_MEAS_RES_OSMO()

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

Change subject: RSL_Types: Add tr_RSL_MEAS_RES_OSMO()
..


RSL_Types: Add tr_RSL_MEAS_RES_OSMO()

This is a template that goes beyond the 3GPP specs, as it expects
presence of certain optional IEs which we know are always present
in the OsmoBTS case.

Change-Id: Ibf37565ab4fe70515b598a2757953628aa780241
---
M library/RSL_Types.ttcn
1 file changed, 22 insertions(+), 0 deletions(-)

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



diff --git a/library/RSL_Types.ttcn b/library/RSL_Types.ttcn
index c9fcfab..2cd5bd5 100644
--- a/library/RSL_Types.ttcn
+++ b/library/RSL_Types.ttcn
@@ -1039,6 +1039,28 @@
}
}
 
+   /* Osmocom specific template, require lots of optional fields to be 
present */
+   template RSL_Message tr_RSL_MEAS_RES_OSMO(template RslChannelNr chan_nr,
+template uint8_t meas_res_nr := ?,
+template RSL_IE_UplinkMeas ul_meas 
:= ?,
+template RSL_IE_BS_Power bs_power 
:= ?,
+template RSL_IE_L1Info l1_info := 
?,
+template octetstring l3_info := ?,
+template uint8_t ms_to := ?) := {
+   msg_disc := ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),
+   msg_type := RSL_MT_MEAS_RES,
+   ies := {
+   tr_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr}),
+   tr_RSL_IE(RSL_IE_Body:{meas_res_nr := meas_res_nr}),
+   tr_RSL_IE(RSL_IE_Body:{uplink_meas := ul_meas}),
+   tr_RSL_IE(RSL_IE_Body:{bs_power := bs_power}),
+   tr_RSL_IE(RSL_IE_Body:{l1_info := l1_info}),
+   tr_RSL_IE(RSL_IE_Body:{l3_info := 
tr_RSL_L16V(l3_info)}),
+   tr_RSL_IE(RSL_IE_Body:{ms_timing_offset := ms_to})
+   }
+   }
+
+
/* 8.4.10 BTS -> BSC */
template RSL_Message ts_RSL_MODE_MODIFY_ACK(RslChannelNr chan_nr) := {
msg_disc := ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibf37565ab4fe70515b598a2757953628aa780241
Gerrit-PatchSet: 1
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]: RSL: Add definitions for RSL MEAS REP parsing/encoding

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

Change subject: RSL: Add definitions for RSL MEAS REP parsing/encoding
..


RSL: Add definitions for RSL MEAS REP parsing/encoding

Change-Id: Ib04b81891def2c15a62767a29b53c0fb605d45be
---
M library/RSL_Types.ttcn
1 file changed, 32 insertions(+), 0 deletions(-)

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



diff --git a/library/RSL_Types.ttcn b/library/RSL_Types.ttcn
index b1716fd..c9fcfab 100644
--- a/library/RSL_Types.ttcn
+++ b/library/RSL_Types.ttcn
@@ -423,6 +423,19 @@
frame_nr := tr_RSL_IE_FrameNumber(frame_nr)
}
 
+   /* 9.3.25 */
+   type record RSL_IE_UplinkMeas {
+   uint8_t len,
+   BIT1 rfu,
+   boolean dtx_d,
+   uint6_t rxlev_f_u,
+   BIT2 reserved1,
+   uint6_t rxlev_s_u,
+   BIT2 reserved2,
+   uint3_t rxq_f_u,
+   uint3_t rxq_s_u,
+   octetstring supp_meas_info optional
+   } with { variant (len) 
"LENGTHTO(rfu,dtx_d,rxlev_f_u,reserved1,rxlev_s_u,reserved2,rxq_f_u,rxq_s_u,supp_meas_info)"
 };
 
/* 9.3.26 */
type enumerated RSL_Cause {
@@ -589,6 +602,8 @@
uint8_t access_delay,
RSL_IE_RachLoad rach_load,
uint8_t meas_res_nr,
+   uint8_t ms_timing_offset,
+   RSL_IE_UplinkMeas   uplink_meas,
RSL_IE_L1Info   l1_info,
RSL_IE_SysinfoType  sysinfo_type,
uint16_tpaging_load,
@@ -635,6 +650,8 @@
access_delay, iei = RSL_IE_ACCESS_DELAY;
rach_load, iei = RSL_IE_RACH_LOAD;
meas_res_nr, iei = RSL_IE_MEAS_RES_NR;
+   ms_timing_offset, iei = 
RSL_IE_MS_TIMING_OFFSET;
+   uplink_meas, iei = RSL_IE_UPLINK_MEAS;
l1_info, iei = RSL_IE_L1_INFO;
sysinfo_type, iei = RSL_IE_SYSINFO_TYPE;
paging_load, iei = RSL_IE_PAGING_LOAD;
@@ -1007,6 +1024,21 @@
}
}
 
+   template RSL_Message tr_RSL_MEAS_RES(template RslChannelNr chan_nr,
+template uint8_t meas_res_nr := ?,
+template RSL_IE_UplinkMeas ul_meas 
:= ?,
+template RSL_IE_BS_Power bs_power 
:= ?) := {
+   msg_disc := ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),
+   msg_type := RSL_MT_MEAS_RES,
+   ies := {
+   tr_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr}),
+   tr_RSL_IE(RSL_IE_Body:{meas_res_nr := meas_res_nr}),
+   tr_RSL_IE(RSL_IE_Body:{uplink_meas := ul_meas}),
+   tr_RSL_IE(RSL_IE_Body:{bs_power := bs_power}),
+   *
+   }
+   }
+
/* 8.4.10 BTS -> BSC */
template RSL_Message ts_RSL_MODE_MODIFY_ACK(RslChannelNr chan_nr) := {
msg_disc := ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),

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

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


osmo-ttcn3-hacks[master]: bsc: fix TC_paging_imsi_a_reset

2018-02-23 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


[MERGED] osmo-ttcn3-hacks[master]: GSM_RR_Types: Fix inverted "valid" logic in measurement report

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

Change subject: GSM_RR_Types: Fix inverted "valid" logic in measurement report
..


GSM_RR_Types: Fix inverted "valid" logic in measurement report

Change-Id: I3ebdd30639b45ba1a9c0fbda7bf2775035833300
---
M library/GSM_RR_Types.ttcn
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/library/GSM_RR_Types.ttcn b/library/GSM_RR_Types.ttcn
index 2625a1f..4d1efd7 100644
--- a/library/GSM_RR_Types.ttcn
+++ b/library/GSM_RR_Types.ttcn
@@ -695,7 +695,7 @@
dtx_used := '0'B,
rxlev_full_srv_cell := rxl_f,
threeg_ba_used := '0'B,
-   meas_valid := bool2bit(valid),
+   meas_valid := bool2bit(not valid),
rxlev_sub_srv_cell := rxl_s,
si23_ba_used := '0'B,
rxqual_full_srv_cell := rxq_f,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3ebdd30639b45ba1a9c0fbda7bf2775035833300
Gerrit-PatchSet: 1
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]: BSC: Add CCHAN_PT recently introduced in RSL_Emulation

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

Change subject: BSC: Add CCHAN_PT recently introduced in RSL_Emulation
..


BSC: Add CCHAN_PT recently introduced in RSL_Emulation

RSL_Emulation has recently gained a port for the common channel
management messages, but BSC_Tests was not updated with this port,
resulting in RSL_Emulation enqueuing messages to the port which then
creates dynamic test case failures.

Let's simply connect to the port, even though we currently are not
interested in any of the messages received there (mainly
RSL_MT_BCCH_INFO during startup).

Change-Id: Id8a3c4409599783ca4cd0b49f2570bcb3bb34952
---
M bsc/BSC_Tests.ttcn
1 file changed, 3 insertions(+), 0 deletions(-)

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



diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 347380a..52ecc1e 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -63,6 +63,8 @@
 type component test_CT extends CTRL_Adapter_CT {
/* Array of per-BTS state */
var BTS_State bts[NUM_BTS];
+   /* RSL common Channel Port (for RSL_Emulation) */
+   port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS];
/* array of per-BTS RSL test ports */
port IPA_RSL_PT IPA_RSL[NUM_BTS];
port IPA_CODEC_PT IPA; /* Required for compilation of 
TC_rsl_unknown_unit_id() */
@@ -154,6 +156,7 @@
clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0";
if (handler_mode) {
clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL");
+   connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]);
}
 
map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT);

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

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


  1   2   >