[MERGED] osmo-gsm-tester[master]: jenkins: build msc using libosmo-sccp master

2017-07-01 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: jenkins: build msc using libosmo-sccp master
..


jenkins: build msc using libosmo-sccp master

Since 81c0bcab068174036f6897e69311f413d94c74d4 was merged, it is not necessary
to build the neels/aoip branch anymore. Other patches on that branch are not
necessary either.

Change-Id: I850e0dd2fc61d59d56c0dd69ee00b6e19685fb95
---
M contrib/jenkins-build-osmo-msc.sh
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/contrib/jenkins-build-osmo-msc.sh 
b/contrib/jenkins-build-osmo-msc.sh
index 53a23fe..f9710c0 100755
--- a/contrib/jenkins-build-osmo-msc.sh
+++ b/contrib/jenkins-build-osmo-msc.sh
@@ -9,7 +9,7 @@
 build_repo libosmo-netif
 build_repo openggsn
 build_repo libsmpp34
-build_repo libosmo-sccp neels/aoip # TEMPORARY BRANCH
+build_repo libosmo-sccp
 build_repo libasn1c
 build_repo osmo-iuh neels/sigtran # TEMPORARY BRANCH
 build_repo openbsc aoip --enable-smpp --enable-osmo-bsc --enable-nat 
--enable-iu

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I850e0dd2fc61d59d56c0dd69ee00b6e19685fb95
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


libosmocore[master]: Add missing BSSGP cause values

2017-07-01 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[MERGED] libosmocore[master]: Add missing BSSGP cause values

2017-07-01 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Add missing BSSGP cause values
..


Add missing BSSGP cause values

Add values from 3GPP TS 48.018

Change-Id: Ie39a6c91a46d179392d861805a106743a07c6fb0
---
M include/osmocom/gprs/protocol/gsm_08_18.h
M src/gb/gprs_bssgp_util.c
2 files changed, 114 insertions(+), 40 deletions(-)

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



diff --git a/include/osmocom/gprs/protocol/gsm_08_18.h 
b/include/osmocom/gprs/protocol/gsm_08_18.h
index 3179455..af6caf3 100644
--- a/include/osmocom/gprs/protocol/gsm_08_18.h
+++ b/include/osmocom/gprs/protocol/gsm_08_18.h
@@ -120,24 +120,61 @@
 
 /*! Cause coding (Section 11.3.8 / Table 11.10) */
 enum gprs_bssgp_cause {
-   BSSGP_CAUSE_PROC_OVERLOAD   = 0x00,
-   BSSGP_CAUSE_EQUIP_FAIL  = 0x01,
-   BSSGP_CAUSE_TRASIT_NET_FAIL = 0x02,
-   BSSGP_CAUSE_CAPA_GREATER_0KPBS  = 0x03,
-   BSSGP_CAUSE_UNKNOWN_MS  = 0x04,
-   BSSGP_CAUSE_UNKNOWN_BVCI= 0x05,
-   BSSGP_CAUSE_CELL_TRAF_CONG  = 0x06,
-   BSSGP_CAUSE_SGSN_CONG   = 0x07,
-   BSSGP_CAUSE_OML_INTERV  = 0x08,
-   BSSGP_CAUSE_BVCI_BLOCKED= 0x09,
-   BSSGP_CAUSE_PFC_CREATE_FAIL = 0x0a,
-   BSSGP_CAUSE_SEM_INCORR_PDU  = 0x20,
-   BSSGP_CAUSE_INV_MAND_INF= 0x21,
-   BSSGP_CAUSE_MISSING_MAND_IE = 0x22,
-   BSSGP_CAUSE_MISSING_COND_IE = 0x23,
-   BSSGP_CAUSE_UNEXP_COND_IE   = 0x24,
-   BSSGP_CAUSE_COND_IE_ERR = 0x25,
-   BSSGP_CAUSE_PDU_INCOMP_STATE= 0x26,
-   BSSGP_CAUSE_PROTO_ERR_UNSPEC= 0x27,
-   BSSGP_CAUSE_PDU_INCOMP_FEAT = 0x28,
+   BSSGP_CAUSE_PROC_OVERLOAD   = 0x00,
+   BSSGP_CAUSE_EQUIP_FAIL  = 0x01,
+   BSSGP_CAUSE_TRASIT_NET_FAIL = 0x02,
+   BSSGP_CAUSE_CAPA_GREATER_0KPBS  = 0x03,
+   BSSGP_CAUSE_UNKNOWN_MS  = 0x04,
+   BSSGP_CAUSE_UNKNOWN_BVCI= 0x05,
+   BSSGP_CAUSE_CELL_TRAF_CONG  = 0x06,
+   BSSGP_CAUSE_SGSN_CONG   = 0x07,
+   BSSGP_CAUSE_OML_INTERV  = 0x08,
+   BSSGP_CAUSE_BVCI_BLOCKED= 0x09,
+   BSSGP_CAUSE_PFC_CREATE_FAIL = 0x0a,
+   BSSGP_CAUSE_PFC_PREEMPTED   = 0x0b,
+   BSSGP_CAUSE_ABQP_NOT_SUPP   = 0x0c,
+   BSSGP_CAUSE_SEM_INCORR_PDU  = 0x20,
+   BSSGP_CAUSE_INV_MAND_INF= 0x21,
+   BSSGP_CAUSE_MISSING_MAND_IE = 0x22,
+   BSSGP_CAUSE_MISSING_COND_IE = 0x23,
+   BSSGP_CAUSE_UNEXP_COND_IE   = 0x24,
+   BSSGP_CAUSE_COND_IE_ERR = 0x25,
+   BSSGP_CAUSE_PDU_INCOMP_STATE= 0x26,
+   BSSGP_CAUSE_PROTO_ERR_UNSPEC= 0x27,
+   BSSGP_CAUSE_PDU_INCOMP_FEAT = 0x28,
+   BSSGP_CAUSE_REQ_INFO_NOT_AVAIL  = 0x29,
+   BSSGP_CAUSE_UNKN_DST= 0x2a,
+   BSSGP_CAUSE_UNKN_RIM_AI = 0x2b,
+   BSSGP_CAUSE_INVAL_CONT_UI   = 0x2c,
+   BSSGP_CAUSE_PFC_QUEUE   = 0x2d,
+   BSSGP_CAUSE_PFC_CREATED = 0x2e,
+   BSSGP_CAUSE_T12_EXPIRY  = 0x2f,
+   BSSGP_CAUSE_MS_UNDER_PS_HO  = 0x30,
+   BSSGP_CAUSE_UL_QUALITY  = 0x31,
+   BSSGP_CAUSE_UL_STRENGTH = 0x32,
+   BSSGP_CAUSE_DL_QUALITY  = 0x33,
+   BSSGP_CAUSE_DL_STRENGTH = 0x34,
+   BSSGP_CAUSE_DISTANCE= 0x35,
+   BSSGP_CAUSE_BETTER_CELL = 0x36,
+   BSSGP_CAUSE_TRAFFIC = 0x37,
+   BSSGP_CAUSE_MS_RADIO_LOSS   = 0x38,
+   BSSGP_CAUSE_MS_BACK_OLD_CHAN= 0x39,
+   BSSGP_CAUSE_T13_EXPIRY  = 0x3a,
+   BSSGP_CAUSE_T14_EXPIRY  = 0x3b,
+   BSSGP_CAUSE_NOT_ALL_PFC = 0x3c,
+   BSSGP_CAUSE_CS  = 0x3d,
+   BSSGP_CAUSE_REQ_ALG_NOT_SUPP= 0x3e,
+   BSSGP_CAUSE_RELOC_FAIL  = 0x3f,
+   BSSGP_CAUSE_DIR_RETRY   = 0x40,
+   BSSGP_CAUSE_TIME_CRIT_RELOC = 0x41,
+   BSSGP_CAUSE_PS_HO_TARG_NA   = 0x42,
+   BSSGP_CAUSE_PS_HO_TARG_NOT_SUPP = 0x43,
+   BSSGP_CAUSE_PUESBINE= 0x44,
+   BSSGP_CAUSE_DTM_HO_NO_CS_RES= 0x45,
+   BSSGP_CAUSE_DTM_HO_PS_ALLOC_FAIL= 0x46,
+   BSSGP_CAUSE_DTM_HO_T24_EXPIRY   = 0x47,
+   BSSGP_CAUSE_DTM_HO_INVAL_CS_IND = 0x48,
+   BSSGP_CAUSE_DTM_HO_T23_EXPIRY   = 0x49,
+   BSSGP_CAUSE_DTM_HO_MSC_ERR  = 0x4a,
+   BSSGP_CAUSE_INVAL_CSG_CELL  = 0x4b,
 };
diff 

libosmo-sccp[master]: sccp_helpers.h: remove duplicate declaration of osmo_sccp_ma...

2017-07-01 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ifbb03de3df3b9bac86fb97dfc8e81e99fc172292
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-gsm-tester[master]: jenkins: build msc using libosmo-sccp master

2017-07-01 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I850e0dd2fc61d59d56c0dd69ee00b6e19685fb95
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-bts[master]: TRX: don't free l1h in trx_phy_inst_close()

2017-07-01 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


[MERGED] osmo-bts[master]: TRX: trx_if: Improve code description / comments

2017-07-01 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: TRX: trx_if: Improve code description / comments
..


TRX: trx_if: Improve code description / comments

Change-Id: I4e19d68782a12e52ba1d3ba2665060275d04866c
---
M src/osmo-bts-trx/trx_if.c
1 file changed, 54 insertions(+), 13 deletions(-)

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



diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index c676d11..b15d24d 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -1,5 +1,9 @@
 /*
- * OpenBTS TRX interface handling
+ * OpenBTS-style TRX interface/protocol handling
+ *
+ * This file contains the BTS-side implementation of the OpenBTS-style
+ * UDP TRX protocol.  It manages the clock, control + burst-data UDP
+ * sockets and their respective protocol encoding/parsing.
  *
  * Copyright (C) 2013  Andreas Eversberg 
  * Copyright (C) 2016  Harald Welte 
@@ -53,10 +57,10 @@
 #define TRX_MAX_BURST_LEN  512
 
 /*
- * socket
+ * socket helper functions
  */
 
-/* open socket */
+/*! convenience wrapper to open socket + fill in osmo_fd */
 static int trx_udp_open(void *priv, struct osmo_fd *ofd, const char 
*host_local,
uint16_t port_local, const char *host_remote, uint16_t 
port_remote,
int (*cb)(struct osmo_fd *fd, unsigned int what))
@@ -77,7 +81,7 @@
return 0;
 }
 
-/* close socket */
+/* close socket + unregister osmo_fd */
 static void trx_udp_close(struct osmo_fd *ofd)
 {
if (ofd->fd > 0) {
@@ -89,7 +93,7 @@
 
 
 /*
- * clock
+ * TRX clock socket
  */
 
 /* get clock from clock socket */
@@ -121,6 +125,7 @@
"correctly, correcting to fn=%u\n", fn);
}
 
+   /* inform core TRX clock handling code that a FN has been received */
trx_sched_clock(pinst->trx->bts, fn);
 
return 0;
@@ -128,7 +133,7 @@
 
 
 /*
- * ctrl
+ * TRX ctrl socket
  */
 
 static void trx_ctrl_timer_cb(void *data);
@@ -165,7 +170,16 @@
trx_ctrl_send(l1h);
 }
 
-/* add a new ctrl command */
+/*! Send a new TRX control command.
+ *  \param[inout] l1h TRX Layer1 handle to which to send command
+ *  \param[in] criticial
+ *  \param[in] cmd zero-terminated string containing command
+ *  \param[in] fmt Format string (+ variable list of arguments)
+ *  \returns 0 on success; negative on error
+ *
+ *  The new ocommand will be added to the end of the control command
+ *  queue.
+ */
 static int trx_ctrl_cmd(struct trx_l1h *l1h, int critical, const char *cmd,
const char *fmt, ...)
 {
@@ -197,15 +211,16 @@
tcm->cmd_len = strlen(cmd);
tcm->critical = critical;
llist_add_tail(>list, >trx_ctrl_list);
-   LOGP(DTRX, LOGL_INFO, "Adding new control '%s'\n", tcm->cmd);
+   LOGP(DTRX, LOGL_INFO, "Enqueuing TRX control command '%s'\n", tcm->cmd);
 
-   /* send message, if no pending message */
+   /* send message, if we didn't already have pending messages */
if (!pending)
trx_ctrl_send(l1h);
 
return 0;
 }
 
+/*! Send "POWEROFF" command to TRX */
 int trx_if_cmd_poweroff(struct trx_l1h *l1h)
 {
struct phy_instance *pinst = l1h->phy_inst;
@@ -215,6 +230,7 @@
return 0;
 }
 
+/*! Send "POWERON" command to TRX */
 int trx_if_cmd_poweron(struct trx_l1h *l1h)
 {
struct phy_instance *pinst = l1h->phy_inst;
@@ -224,6 +240,7 @@
return 0;
 }
 
+/*! Send "SETTSC" command to TRX */
 int trx_if_cmd_settsc(struct trx_l1h *l1h, uint8_t tsc)
 {
if (!settsc_enabled)
@@ -233,6 +250,7 @@
tsc);
 }
 
+/*! Send "SETBSIC" command to TRX */
 int trx_if_cmd_setbsic(struct trx_l1h *l1h, uint8_t bsic)
 {
if (!setbsic_enabled)
@@ -242,31 +260,37 @@
bsic);
 }
 
+/*! Send "SETRXGAIN" command to TRX */
 int trx_if_cmd_setrxgain(struct trx_l1h *l1h, int db)
 {
return trx_ctrl_cmd(l1h, 0, "SETRXGAIN", "%d", db);
 }
 
+/*! Send "SETPOWER" command to TRX */
 int trx_if_cmd_setpower(struct trx_l1h *l1h, int db)
 {
return trx_ctrl_cmd(l1h, 0, "SETPOWER", "%d", db);
 }
 
+/*! Send "SETMAXDLY" command to TRX, i.e. maximum delay for RACH bursts */
 int trx_if_cmd_setmaxdly(struct trx_l1h *l1h, int dly)
 {
return trx_ctrl_cmd(l1h, 0, "SETMAXDLY", "%d", dly);
 }
 
+/*! Send "SETMAXDLYNB" command to TRX, i.e. maximum delay for normal bursts */
 int trx_if_cmd_setmaxdlynb(struct trx_l1h *l1h, int dly)
 {
return trx_ctrl_cmd(l1h, 0, "SETMAXDLYNB", "%d", dly);
 }
 
+/*! Send "SETSLOT" command to TRX: Configure Channel Combination for TS */
 int trx_if_cmd_setslot(struct trx_l1h *l1h, uint8_t tn, uint8_t type)
 {
return trx_ctrl_cmd(l1h, 1, "SETSLOT", "%d %d", tn, type);
 }
 
+/*! Send "RXTUNE" command to TRX: Tune Receiver to given ARFCN */
 int 

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

2017-07-01 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: TRX: Rename trx_if_data() -> trx_if_send_burst()
..


TRX: Rename trx_if_data() -> trx_if_send_burst()

The new name makes it clear what the function actually does: Send burst
data via the trx interface.

Change-Id: I5031541d4ae4244a62a18acf71139db2874927fa
---
M src/osmo-bts-trx/scheduler_trx.c
M src/osmo-bts-trx/trx_if.c
M src/osmo-bts-trx/trx_if.h
3 files changed, 3 insertions(+), 3 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/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 9c87643..a9bcbda 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -1398,7 +1398,7 @@
} else
gain = 0;
if (nbits)
-   trx_if_data(l1h, tn, fn, gain, bits, nbits);
+   trx_if_send_burst(l1h, tn, fn, gain, bits, 
nbits);
}
}
 
diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index 2486894..ba2908a 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -498,7 +498,7 @@
  *  \param[in] bits Unpacked bits to be transmitted
  *  \param[in] nbits Number of \a bits
  *  \returns 0 on success; negative on error */
-int trx_if_data(struct trx_l1h *l1h, uint8_t tn, uint32_t fn, uint8_t pwr,
+int trx_if_send_burst(struct trx_l1h *l1h, uint8_t tn, uint32_t fn, uint8_t 
pwr,
const ubit_t *bits, uint16_t nbits)
 {
uint8_t buf[TRX_MAX_BURST_LEN];
diff --git a/src/osmo-bts-trx/trx_if.h b/src/osmo-bts-trx/trx_if.h
index 05e8bff..93ea180 100644
--- a/src/osmo-bts-trx/trx_if.h
+++ b/src/osmo-bts-trx/trx_if.h
@@ -29,7 +29,7 @@
 int trx_if_cmd_txtune(struct trx_l1h *l1h, uint16_t arfcn);
 int trx_if_cmd_handover(struct trx_l1h *l1h, uint8_t tn, uint8_t ss);
 int trx_if_cmd_nohandover(struct trx_l1h *l1h, uint8_t tn, uint8_t ss);
-int trx_if_data(struct trx_l1h *l1h, uint8_t tn, uint32_t fn, uint8_t pwr,
+int trx_if_send_burst(struct trx_l1h *l1h, uint8_t tn, uint32_t fn, uint8_t 
pwr,
const ubit_t *bits, uint16_t nbits);
 int trx_if_open(struct trx_l1h *l1h);
 void trx_if_flush(struct trx_l1h *l1h);

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

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


[MERGED] osmo-bts[master]: TRX: merge/simplify l1_if and trx_if code

2017-07-01 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: TRX: merge/simplify l1_if and trx_if code
..


TRX: merge/simplify l1_if and trx_if code

Related code / function structure still dates back to the pre-phy_link
days.  Let's clean this up to make things less convoluted and reduce the
number of non-static symbols needed between code split over two files.

Change-Id: I1f30ae1f547a5c01c516d4a05032193294c25f2d
---
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-trx/l1_if.h
M src/osmo-bts-trx/trx_if.c
M src/osmo-bts-trx/trx_if.h
4 files changed, 93 insertions(+), 104 deletions(-)

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



diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index 3517787..37a399f 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -57,48 +57,6 @@
 };
 
 
-/*
- * create/destroy trx l1 instance
- */
-
-struct trx_l1h *l1if_open(struct phy_instance *pinst)
-{
-   struct trx_l1h *l1h;
-   int rc;
-
-   l1h = pinst->u.osmotrx.hdl;
-   if (!l1h)
-   return NULL;
-
-   rc = trx_sched_init(>l1s, pinst->trx);
-   if (rc < 0) {
-   LOGP(DL1C, LOGL_FATAL, "Cannot initialize scheduler for phy "
-"instance %d\n", pinst->num);
-   return NULL;
-   }
-
-   rc = trx_if_open(l1h);
-   if (rc < 0) {
-   LOGP(DL1C, LOGL_FATAL, "Cannot open TRX interface for phy "
-"instance %d\n", pinst->num);
-   l1if_close(l1h);
-   return NULL;
-   }
-
-   return l1h;
-}
-
-void l1if_close(struct trx_l1h *l1h)
-{
-   trx_if_close(l1h);
-   trx_sched_exit(>l1s);
-   talloc_free(l1h);
-}
-
-void l1if_reset(struct trx_l1h *l1h)
-{
-}
-
 static void check_transceiver_availability_trx(struct trx_l1h *l1h, int avail)
 {
struct phy_instance *pinst = l1h->phy_inst;
diff --git a/src/osmo-bts-trx/l1_if.h b/src/osmo-bts-trx/l1_if.h
index fdc40f2..d978c44 100644
--- a/src/osmo-bts-trx/l1_if.h
+++ b/src/osmo-bts-trx/l1_if.h
@@ -61,9 +61,6 @@
struct l1sched_trx  l1s;
 };
 
-struct trx_l1h *l1if_open(struct phy_instance *pinst);
-void l1if_close(struct trx_l1h *l1h);
-void l1if_reset(struct trx_l1h *l1h);
 int check_transceiver_availability(struct gsm_bts *bts, int avail);
 int l1if_provision_transceiver_trx(struct trx_l1h *l1h);
 int l1if_provision_transceiver(struct gsm_bts *bts);
diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index ba2908a..c56efbf 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -536,47 +536,32 @@
  * open/close
  */
 
-/*! open the PHY link using TRX protocol */
-int bts_model_phy_link_open(struct phy_link *plink)
+/*! flush (delete) all pending control messages */
+void trx_if_flush(struct trx_l1h *l1h)
 {
-   struct phy_instance *pinst;
-   int rc;
+   struct trx_ctrl_msg *tcm;
 
-   phy_link_state_set(plink, PHY_LINK_CONNECTING);
-
-   /* open the shared/common clock socket */
-   rc = trx_udp_open(plink, >u.osmotrx.trx_ofd_clk,
- plink->u.osmotrx.local_ip,
- plink->u.osmotrx.base_port_local,
- plink->u.osmotrx.remote_ip,
- plink->u.osmotrx.base_port_remote,
- trx_clk_read_cb);
-   if (rc < 0) {
-   phy_link_state_set(plink, PHY_LINK_SHUTDOWN);
-   return -1;
+   /* free ctrl message list */
+   while (!llist_empty(>trx_ctrl_list)) {
+   tcm = llist_entry(l1h->trx_ctrl_list.next, struct trx_ctrl_msg,
+   list);
+   llist_del(>list);
+   talloc_free(tcm);
}
+}
 
-   /* open the individual instances with their ctrl+data sockets */
-   llist_for_each_entry(pinst, >instances, list) {
-   pinst->u.osmotrx.hdl = l1if_open(pinst);
-   if (!pinst->u.osmotrx.hdl)
-   goto cleanup;
-   }
-   /* FIXME: is there better way to check/report TRX availability? */
-   transceiver_available = 1;
-   phy_link_state_set(plink, PHY_LINK_CONNECTED);
-   return 0;
+/*! close the TRX for given handle (data + control socket) */
+void trx_if_close(struct trx_l1h *l1h)
+{
+   struct phy_instance *pinst = l1h->phy_inst;
+   LOGP(DTRX, LOGL_NOTICE, "Close transceiver for %s\n",
+   phy_instance_name(pinst));
 
-cleanup:
-   phy_link_state_set(plink, PHY_LINK_SHUTDOWN);
-   llist_for_each_entry(pinst, >instances, list) {
-   if (pinst->u.osmotrx.hdl) {
-   trx_if_close(pinst->u.osmotrx.hdl);
-   pinst->u.osmotrx.hdl = NULL;
-   }
-   }
-   trx_udp_close(>u.osmotrx.trx_ofd_clk);
-   return -1;
+   trx_if_flush(l1h);
+
+   /* close sockets 

[MERGED] osmo-bts[master]: TRX: don't free l1h in trx_phy_inst_close()

2017-07-01 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: TRX: don't free l1h in trx_phy_inst_close()
..


TRX: don't free l1h in trx_phy_inst_close()

l1h is allocated in bts_model_phy_instance_set_defaults() and not in
trx_phy_inst_open().  Hence, trx_phy_inst_close() should not free() it!

Change-Id: I0ac4e57a882e5a31143499c1662d8d8e52320938
---
M src/osmo-bts-trx/trx_if.c
1 file changed, 0 insertions(+), 1 deletion(-)

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



diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index c56efbf..8ce2893 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -629,7 +629,6 @@
 
trx_if_close(l1h);
trx_sched_exit(>l1s);
-   talloc_free(l1h);
 }
 
 /*! open the control + burst data sockets for one phy_instance */

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

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


[MERGED] osmo-bts[master]: trx_if: Improve error handling

2017-07-01 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: trx_if: Improve error handling
..


trx_if: Improve error handling

There ware some error conditions that the previous code didn't catch
and/or report, such as unparseable TRX control strings, non-terminated
buffers, ...

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

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



diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index b15d24d..2486894 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -6,7 +6,7 @@
  * sockets and their respective protocol encoding/parsing.
  *
  * Copyright (C) 2013  Andreas Eversberg 
- * Copyright (C) 2016  Harald Welte 
+ * Copyright (C) 2016-2017  Harald Welte 
  *
  * All Rights Reserved
  *
@@ -84,7 +84,7 @@
 /* close socket + unregister osmo_fd */
 static void trx_udp_close(struct osmo_fd *ofd)
 {
-   if (ofd->fd > 0) {
+   if (ofd->fd >= 0) {
osmo_fd_unregister(ofd);
close(ofd->fd);
ofd->fd = -1;
@@ -116,7 +116,11 @@
return 0;
}
 
-   sscanf(buf, "IND CLOCK %u", );
+   if (sscanf(buf, "IND CLOCK %u", ) != 1) {
+   LOGP(DTRX, LOGL_ERROR, "Unable to parse '%s'\n", buf);
+   return 0;
+   }
+
LOGP(DTRX, LOGL_INFO, "Clock indication: fn=%u\n", fn);
 
if (fn >= GSM_HYPERFRAME) {
@@ -208,6 +212,7 @@
va_end(ap);
} else
snprintf(tcm->cmd, sizeof(tcm->cmd)-1, "CMD %s", cmd);
+   tcm->cmd[sizeof(tcm->cmd)-1] = '\0';
tcm->cmd_len = strlen(cmd);
tcm->critical = critical;
llist_add_tail(>list, >trx_ctrl_list);

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

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


osmo-bts[master]: OML: fill MO while handling attr. request

2017-07-01 Thread Harald Welte

Patch Set 1: Code-Review-2

(1 comment)

https://gerrit.osmocom.org/#/c/3090/1/src/common/oml.c
File src/common/oml.c:

Line 1126:  bts->mo.obj_inst.trx_nr = foh->obj_inst.trx_nr;
this most certainly is completely wrong.  The bts->mo is the instance of the 
managed object for the BTS. It's "MO Address" is configured once statically at 
BTS startup and never modified - *particularly* not by a get/read request.


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

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


[MERGED] libosmocore[master]: l1sap.h: Add ber10k and lqual_cb to ph_tch_param

2017-07-01 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: l1sap.h: Add ber10k and lqual_cb to ph_tch_param
..


l1sap.h: Add ber10k and lqual_cb to ph_tch_param

These fields are required in osmo-bts to do low link quality checks in a
generic way.

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

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



diff --git a/include/osmocom/gsm/l1sap.h b/include/osmocom/gsm/l1sap.h
index 01f61ce..1bc1818 100644
--- a/include/osmocom/gsm/l1sap.h
+++ b/include/osmocom/gsm/l1sap.h
@@ -84,6 +84,8 @@
uint32_t fn;/*!< GSM Frame Number */
int8_t rssi;/*!< RSSI of received indication */
uint8_t marker; /*!< RTP Marker bit (speech onset indicator) */
+   uint16_t ber10k;/*!< BER in units of 0.01% */
+   int16_t lqual_cb;   /* !< Link quality in centiBel */
 };
 
 /*! for PH-CONN.ind */

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

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


openbsc[master]: bsc_init: add logging for unhandled signals

2017-07-01 Thread Harald Welte

Patch Set 2: Code-Review-1

so we add a new signal in libosmo-abis and all existing applications will print 
erros? What's the rationale here?

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0ddaec3b017d637027b0478ce3e137becbf25ea7
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-bts[master]: l1sap.c: Avoid sending RTP frame with empty payload

2017-07-01 Thread Harald Welte

Patch Set 5: Code-Review+2

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

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


libosmocore[master]: l1sap.h: Add ber10k and lqual_cb to ph_tch_param

2017-07-01 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-bts[master]: l1sap.c: fn_ms_adj: Add err logging and always return GSM_RT...

2017-07-01 Thread Harald Welte

Patch Set 2:

please clarify with Max rgarding DTX and also ask is help to verify DTX still 
works after all related changes.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I9d112c6db142be138e71393e77129e6d069d9973
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: No


osmo-bts[master]: octphy/tch.c: Use L1P instead of L1C for logging and allocation

2017-07-01 Thread Harald Welte

Patch Set 1:

can merge in one patch for all bts models, and that patch should state reasons 
in commitlog

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

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


osmo-bts[master]: Fix annoying trailing whitespace

2017-07-01 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-bts[master]: Log fn across different layers

2017-07-01 Thread Harald Welte

Patch Set 1: Code-Review-1

(1 comment)

https://gerrit.osmocom.org/#/c/3098/1/src/common/l1sap.c
File src/common/l1sap.c:

PS1, Line 966: %
I think we should introduce a generic fn-print-helper like I introduced in 
Change-Id Idd07a3f4a88c38398d3e844333c0104e2de23864 (dump_gsmtims).  Actually, 
that function should move to libosmocore (and get an osmo_ prefix) and then all 
code should use that function.


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

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


osmo-bts[master]: Allow passing low link quality buffers to upper layers

2017-07-01 Thread Harald Welte

Patch Set 4: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: If5df8940fab833eb4e3ed851880b66987d356031
Gerrit-PatchSet: 4
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


osmo-bts[master]: sysmo, litecell15: Make sure all TCH events are triggered

2017-07-01 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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