aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2019-09-25 10:39:40 +0200
committerlaforge <laforge@osmocom.org>2019-10-11 10:46:02 +0000
commit5fee4d1ff5fac53bc21ed19abf2f84456486fa44 (patch)
treef8387d2bcff68f83320ff3da3f02c2e02a7ef439
parenta4c54b531c05151f7074be952a22f1891aa0fcc6 (diff)
log: set L1 SAPI log contextHEADmaster
Add a new common L1 SAPI enum, to unify all the BTS specific SAPIs. Translate to this enum, and set the context for uplink messages in each BTS specific implementation. Set the context for downlink messages in the common l1sap code, by converting the osmo_phsap_prim back to the SAPI value (mostly looking at chan_nr). The new functions for doing this conversion, get_common_sapi_by_trx_prim() and get_common_sapi_ph_data(), are based on the existing to_gsmtap() and gsmtap_ph_data() functions. Note that we can't set the uplink SAPI context in the common code, because then we can't set it as early as possible. In this patch, the SAPI context is set for the PHYs where the SAPI is readily available. With additional conversion from the RSL channel, the SAPI context could be set for osmo-bts-trx in a follow up patch. Related: OS#2356 Depends: (libosmocore) I814cb3328d99faca9220adb5a80ffb934f219d7d Change-Id: I6b7bb2e1d61502b61214f854a4ec5cbb7267545b
-rw-r--r--include/osmo-bts/l1sap.h31
-rw-r--r--src/common/l1sap.c82
-rw-r--r--src/osmo-bts-litecell15/l1_if.c44
-rw-r--r--src/osmo-bts-oc2g/l1_if.c44
-rw-r--r--src/osmo-bts-octphy/l1_if.c47
-rw-r--r--src/osmo-bts-sysmo/l1_if.c45
6 files changed, 293 insertions, 0 deletions
diff --git a/include/osmo-bts/l1sap.h b/include/osmo-bts/l1sap.h
index 7ae5d38d..1883869f 100644
--- a/include/osmo-bts/l1sap.h
+++ b/include/osmo-bts/l1sap.h
@@ -96,6 +96,37 @@ int l1sap_chan_rel(struct gsm_bts_trx *trx, uint8_t chan_nr);
int l1sap_chan_deact_sacch(struct gsm_bts_trx *trx, uint8_t chan_nr);
int l1sap_chan_modify(struct gsm_bts_trx *trx, uint8_t chan_nr);
+enum l1sap_common_sapi {
+ L1SAP_COMMON_SAPI_UNKNOWN,
+ /* alphabetic order */
+ L1SAP_COMMON_SAPI_AGCH,
+ L1SAP_COMMON_SAPI_BCCH,
+ L1SAP_COMMON_SAPI_CBCH,
+ L1SAP_COMMON_SAPI_FACCH_F,
+ L1SAP_COMMON_SAPI_FACCH_H,
+ L1SAP_COMMON_SAPI_FCCH,
+ L1SAP_COMMON_SAPI_IDLE,
+ L1SAP_COMMON_SAPI_NCH,
+ L1SAP_COMMON_SAPI_PACCH,
+ L1SAP_COMMON_SAPI_PAGCH,
+ L1SAP_COMMON_SAPI_PBCCH,
+ L1SAP_COMMON_SAPI_PCH,
+ L1SAP_COMMON_SAPI_PDTCH,
+ L1SAP_COMMON_SAPI_PNCH,
+ L1SAP_COMMON_SAPI_PPCH,
+ L1SAP_COMMON_SAPI_PRACH,
+ L1SAP_COMMON_SAPI_PTCCH,
+ L1SAP_COMMON_SAPI_RACH,
+ L1SAP_COMMON_SAPI_SACCH,
+ L1SAP_COMMON_SAPI_SCH,
+ L1SAP_COMMON_SAPI_SDCCH,
+ L1SAP_COMMON_SAPI_TCH_F,
+ L1SAP_COMMON_SAPI_TCH_H,
+};
+
+extern uint16_t l1sap_log_ctx_sapi;
+extern const struct value_string l1sap_common_sapi_names[];
+
extern const struct value_string gsmtap_sapi_names[];
extern struct gsmtap_inst *gsmtap;
extern uint32_t gsmtap_sapi_mask;
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 2008f0e3..7c543804 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -257,6 +257,85 @@ int bts_check_for_ciph_cmd(struct msgb *msg, struct gsm_lchan *lchan,
return check_for_ciph_cmd(msg, lchan, chan_nr);
}
+uint16_t l1sap_log_ctx_sapi;
+
+const struct value_string l1sap_common_sapi_names[] = {
+ { L1SAP_COMMON_SAPI_UNKNOWN, "UNKNOWN" },
+ /* alphabetic order */
+ { L1SAP_COMMON_SAPI_AGCH, "AGCH" },
+ { L1SAP_COMMON_SAPI_BCCH, "BCCH" },
+ { L1SAP_COMMON_SAPI_CBCH, "CBCH" },
+ { L1SAP_COMMON_SAPI_FACCH_F, "FACCH/F" },
+ { L1SAP_COMMON_SAPI_FACCH_H, "FACCH/H" },
+ { L1SAP_COMMON_SAPI_FCCH, "FCCH" },
+ { L1SAP_COMMON_SAPI_IDLE, "IDLE" },
+ { L1SAP_COMMON_SAPI_NCH, "NCH" },
+ { L1SAP_COMMON_SAPI_PACCH, "PACCH" },
+ { L1SAP_COMMON_SAPI_PAGCH, "PAGCH" },
+ { L1SAP_COMMON_SAPI_PBCCH, "PBCCH" },
+ { L1SAP_COMMON_SAPI_PCH, "PCH" },
+ { L1SAP_COMMON_SAPI_PDTCH, "PDTCH" },
+ { L1SAP_COMMON_SAPI_PNCH, "PNCH" },
+ { L1SAP_COMMON_SAPI_PPCH, "PPCH" },
+ { L1SAP_COMMON_SAPI_PRACH, "PRACH" },
+ { L1SAP_COMMON_SAPI_PTCCH, "PTCCH" },
+ { L1SAP_COMMON_SAPI_RACH, "RACH" },
+ { L1SAP_COMMON_SAPI_SACCH, "SACCH" },
+ { L1SAP_COMMON_SAPI_SCH, "SCH" },
+ { L1SAP_COMMON_SAPI_SDCCH, "SDCCH" },
+ { L1SAP_COMMON_SAPI_TCH_F, "TCH/F" },
+ { L1SAP_COMMON_SAPI_TCH_H, "TCH/H" },
+ { 0, NULL }
+};
+
+static enum l1sap_common_sapi get_common_sapi_ph_data(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap)
+{
+ uint8_t link_id = l1sap->u.data.link_id;
+ uint8_t chan_nr = l1sap->u.data.chan_nr;
+ uint32_t u32Fn = l1sap->u.data.fn;
+
+ if (L1SAP_IS_CHAN_TCHF(chan_nr))
+ return L1SAP_COMMON_SAPI_TCH_F;
+
+ if (L1SAP_IS_CHAN_TCHH(chan_nr))
+ return L1SAP_COMMON_SAPI_TCH_H;
+
+ if (L1SAP_IS_CHAN_SDCCH4(chan_nr) || L1SAP_IS_CHAN_SDCCH8(chan_nr))
+ return L1SAP_COMMON_SAPI_SDCCH;
+
+ if (L1SAP_IS_CHAN_BCCH(chan_nr))
+ return L1SAP_COMMON_SAPI_BCCH;
+
+ if (L1SAP_IS_CHAN_AGCH_PCH(chan_nr))
+ /* The sapi depends on DSP configuration, not on the actual SYSTEM INFORMATION 3. */
+ return ((l1sap_fn2ccch_block(u32Fn) >= num_agch(trx, "PH-DATA-REQ"))
+ ? L1SAP_COMMON_SAPI_PCH
+ : L1SAP_COMMON_SAPI_AGCH);
+
+ if (L1SAP_IS_CHAN_CBCH(chan_nr))
+ return L1SAP_COMMON_SAPI_CBCH;
+
+ if (L1SAP_IS_LINK_SACCH(link_id))
+ return L1SAP_COMMON_SAPI_SACCH;
+
+ return L1SAP_COMMON_SAPI_UNKNOWN;
+}
+
+static enum l1sap_common_sapi get_common_sapi_by_trx_prim(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap)
+{
+ /* Only downlink prims are relevant */
+ switch (OSMO_PRIM_HDR(&l1sap->oph)) {
+ case OSMO_PRIM(PRIM_PH_DATA, PRIM_OP_REQUEST):
+ if (ts_is_pdch(&trx->ts[L1SAP_CHAN2TS(l1sap->u.data.chan_nr)]))
+ return ((L1SAP_IS_PTCCH(l1sap->u.data.fn))
+ ? L1SAP_COMMON_SAPI_PTCCH
+ : L1SAP_COMMON_SAPI_PDTCH);
+ return get_common_sapi_ph_data(trx, l1sap);
+ default:
+ return L1SAP_COMMON_SAPI_UNKNOWN;
+ }
+}
+
struct gsmtap_inst *gsmtap = NULL;
uint32_t gsmtap_sapi_mask = 0;
uint8_t gsmtap_sapi_acch = 0;
@@ -1455,6 +1534,9 @@ int l1sap_up(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap)
/* any L1 prim sent to bts model */
static int l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap)
{
+ l1sap_log_ctx_sapi = get_common_sapi_by_trx_prim(trx, l1sap);
+ log_set_context(LOG_CTX_L1_SAPI, &l1sap_log_ctx_sapi);
+
if (OSMO_PRIM_HDR(&l1sap->oph) ==
OSMO_PRIM(PRIM_PH_DATA, PRIM_OP_REQUEST))
to_gsmtap(trx, l1sap);
diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index 2ac0b7ab..d7e0cde5 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -795,6 +795,45 @@ static uint8_t chan_nr_by_sapi(struct gsm_bts_trx_ts *ts,
return (cbits << 3) | u8Tn;
}
+static const enum l1sap_common_sapi common_sapi_by_sapi_t[] = {
+ [GsmL1_Sapi_Idle] = L1SAP_COMMON_SAPI_IDLE,
+ [GsmL1_Sapi_Fcch] = L1SAP_COMMON_SAPI_FCCH,
+ [GsmL1_Sapi_Sch] = L1SAP_COMMON_SAPI_SCH,
+ [GsmL1_Sapi_Sacch] = L1SAP_COMMON_SAPI_SACCH,
+ [GsmL1_Sapi_Sdcch] = L1SAP_COMMON_SAPI_SDCCH,
+ [GsmL1_Sapi_Bcch] = L1SAP_COMMON_SAPI_BCCH,
+ [GsmL1_Sapi_Pch] = L1SAP_COMMON_SAPI_PCH,
+ [GsmL1_Sapi_Agch] = L1SAP_COMMON_SAPI_AGCH,
+ [GsmL1_Sapi_Cbch] = L1SAP_COMMON_SAPI_CBCH,
+ [GsmL1_Sapi_Rach] = L1SAP_COMMON_SAPI_RACH,
+ [GsmL1_Sapi_TchF] = L1SAP_COMMON_SAPI_TCH_F,
+ [GsmL1_Sapi_FacchF] = L1SAP_COMMON_SAPI_FACCH_F,
+ [GsmL1_Sapi_TchH] = L1SAP_COMMON_SAPI_TCH_H,
+ [GsmL1_Sapi_FacchH] = L1SAP_COMMON_SAPI_FACCH_H,
+ [GsmL1_Sapi_Nch] = L1SAP_COMMON_SAPI_NCH,
+ [GsmL1_Sapi_Pdtch] = L1SAP_COMMON_SAPI_PDTCH,
+ [GsmL1_Sapi_Pacch] = L1SAP_COMMON_SAPI_PACCH,
+ [GsmL1_Sapi_Pbcch] = L1SAP_COMMON_SAPI_PBCCH,
+ [GsmL1_Sapi_Pagch] = L1SAP_COMMON_SAPI_PAGCH,
+ [GsmL1_Sapi_Ppch] = L1SAP_COMMON_SAPI_PPCH,
+ [GsmL1_Sapi_Pnch] = L1SAP_COMMON_SAPI_PNCH,
+ [GsmL1_Sapi_Ptcch] = L1SAP_COMMON_SAPI_PTCCH,
+ [GsmL1_Sapi_Prach] = L1SAP_COMMON_SAPI_PRACH,
+};
+
+static enum l1sap_common_sapi get_common_sapi(GsmL1_Sapi_t sapi)
+{
+ if (sapi >= GsmL1_Sapi_NUM)
+ return L1SAP_COMMON_SAPI_UNKNOWN;
+ return common_sapi_by_sapi_t[sapi];
+}
+
+static void set_log_ctx_sapi(GsmL1_Sapi_t sapi)
+{
+ l1sap_log_ctx_sapi = get_common_sapi(sapi);
+ log_set_context(LOG_CTX_L1_SAPI, &l1sap_log_ctx_sapi);
+}
+
static int handle_ph_readytosend_ind(struct lc15l1_hdl *fl1,
GsmL1_PhReadyToSendInd_t *rts_ind,
struct msgb *l1p_msg)
@@ -811,6 +850,8 @@ static int handle_ph_readytosend_ind(struct lc15l1_hdl *fl1,
uint8_t chan_nr, link_id;
uint32_t fn;
+ set_log_ctx_sapi(rts_ind->sapi);
+
/* check if primitive should be handled by common part */
chan_nr = chan_nr_by_sapi(&trx->ts[rts_ind->u8Tn], rts_ind->sapi,
rts_ind->subCh, rts_ind->u8Tn, rts_ind->u32Fn);
@@ -933,6 +974,8 @@ static int handle_ph_data_ind(struct lc15l1_hdl *fl1, GsmL1_PhDataInd_t *data_in
int rc = 0;
int8_t rssi;
+ set_log_ctx_sapi(data_ind->sapi);
+
chan_nr = chan_nr_by_sapi(&trx->ts[data_ind->u8Tn], data_ind->sapi,
data_ind->subCh, data_ind->u8Tn, data_ind->u32Fn);
fn = data_ind->u32Fn;
@@ -1002,6 +1045,7 @@ static int handle_ph_ra_ind(struct lc15l1_hdl *fl1, GsmL1_PhRaInd_t *ra_ind,
int rc;
struct ph_rach_ind_param rach_ind_param;
+ set_log_ctx_sapi(ra_ind->sapi);
dump_meas_res(LOGL_DEBUG, &ra_ind->measParam);
if ((ra_ind->msgUnitParam.u8Size != 1) &&
diff --git a/src/osmo-bts-oc2g/l1_if.c b/src/osmo-bts-oc2g/l1_if.c
index d987bb52..d8be2d6d 100644
--- a/src/osmo-bts-oc2g/l1_if.c
+++ b/src/osmo-bts-oc2g/l1_if.c
@@ -847,6 +847,45 @@ static uint8_t chan_nr_by_sapi(struct gsm_bts_trx_ts *ts,
return (cbits << 3) | u8Tn;
}
+static const enum l1sap_common_sapi common_sapi_by_sapi_t[] = {
+ [GsmL1_Sapi_Idle] = L1SAP_COMMON_SAPI_IDLE,
+ [GsmL1_Sapi_Fcch] = L1SAP_COMMON_SAPI_FCCH,
+ [GsmL1_Sapi_Sch] = L1SAP_COMMON_SAPI_SCH,
+ [GsmL1_Sapi_Sacch] = L1SAP_COMMON_SAPI_SACCH,
+ [GsmL1_Sapi_Sdcch] = L1SAP_COMMON_SAPI_SDCCH,
+ [GsmL1_Sapi_Bcch] = L1SAP_COMMON_SAPI_BCCH,
+ [GsmL1_Sapi_Pch] = L1SAP_COMMON_SAPI_PCH,
+ [GsmL1_Sapi_Agch] = L1SAP_COMMON_SAPI_AGCH,
+ [GsmL1_Sapi_Cbch] = L1SAP_COMMON_SAPI_CBCH,
+ [GsmL1_Sapi_Rach] = L1SAP_COMMON_SAPI_RACH,
+ [GsmL1_Sapi_TchF] = L1SAP_COMMON_SAPI_TCH_F,
+ [GsmL1_Sapi_FacchF] = L1SAP_COMMON_SAPI_FACCH_F,
+ [GsmL1_Sapi_TchH] = L1SAP_COMMON_SAPI_TCH_H,
+ [GsmL1_Sapi_FacchH] = L1SAP_COMMON_SAPI_FACCH_H,
+ [GsmL1_Sapi_Nch] = L1SAP_COMMON_SAPI_NCH,
+ [GsmL1_Sapi_Pdtch] = L1SAP_COMMON_SAPI_PDTCH,
+ [GsmL1_Sapi_Pacch] = L1SAP_COMMON_SAPI_PACCH,
+ [GsmL1_Sapi_Pbcch] = L1SAP_COMMON_SAPI_PBCCH,
+ [GsmL1_Sapi_Pagch] = L1SAP_COMMON_SAPI_PAGCH,
+ [GsmL1_Sapi_Ppch] = L1SAP_COMMON_SAPI_PPCH,
+ [GsmL1_Sapi_Pnch] = L1SAP_COMMON_SAPI_PNCH,
+ [GsmL1_Sapi_Ptcch] = L1SAP_COMMON_SAPI_PTCCH,
+ [GsmL1_Sapi_Prach] = L1SAP_COMMON_SAPI_PRACH,
+};
+
+static enum l1sap_common_sapi get_common_sapi(GsmL1_Sapi_t sapi)
+{
+ if (sapi >= GsmL1_Sapi_NUM)
+ return L1SAP_COMMON_SAPI_UNKNOWN;
+ return common_sapi_by_sapi_t[sapi];
+}
+
+static void set_log_ctx_sapi(GsmL1_Sapi_t sapi)
+{
+ l1sap_log_ctx_sapi = get_common_sapi(sapi);
+ log_set_context(LOG_CTX_L1_SAPI, &l1sap_log_ctx_sapi);
+}
+
static int handle_ph_readytosend_ind(struct oc2gl1_hdl *fl1,
GsmL1_PhReadyToSendInd_t *rts_ind,
struct msgb *l1p_msg)
@@ -863,6 +902,8 @@ static int handle_ph_readytosend_ind(struct oc2gl1_hdl *fl1,
uint8_t chan_nr, link_id;
uint32_t fn;
+ set_log_ctx_sapi(rts_ind->sapi);
+
/* check if primitive should be handled by common part */
chan_nr = chan_nr_by_sapi(&trx->ts[rts_ind->u8Tn], rts_ind->sapi,
rts_ind->subCh, rts_ind->u8Tn, rts_ind->u32Fn);
@@ -989,6 +1030,8 @@ static int handle_ph_data_ind(struct oc2gl1_hdl *fl1, GsmL1_PhDataInd_t *data_in
int rc = 0;
int8_t rssi;
+ set_log_ctx_sapi(data_ind->sapi);
+
chan_nr = chan_nr_by_sapi(&trx->ts[data_ind->u8Tn], data_ind->sapi,
data_ind->subCh, data_ind->u8Tn, data_ind->u32Fn);
fn = data_ind->u32Fn;
@@ -1058,6 +1101,7 @@ static int handle_ph_ra_ind(struct oc2gl1_hdl *fl1, GsmL1_PhRaInd_t *ra_ind,
int rc;
struct ph_rach_ind_param rach_ind_param;
+ set_log_ctx_sapi(ra_ind->sapi);
dump_meas_res(LOGL_DEBUG, &ra_ind->measParam);
if ((ra_ind->msgUnitParam.u8Size != 1) &&
diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index 612c29ad..bf2fa355 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -938,6 +938,47 @@ static int handle_mph_time_ind(struct octphy_hdl *fl1, uint8_t trx_id, uint32_t
return 0;
}
+/* octv1_gsm_api.h does not have an end marker for CTVC1_GSM_SAPI_ENUM */
+#define _OCTVC1_GSM_SAPI_ENUM_LENGTH (cOCTVC1_GSM_SAPI_ENUM_PRACH + 1)
+
+static const enum l1sap_common_sapi common_sapi_by_oct_sapi[] = {
+ [cOCTVC1_GSM_SAPI_ENUM_IDLE] = L1SAP_COMMON_SAPI_IDLE,
+ [cOCTVC1_GSM_SAPI_ENUM_FCCH] = L1SAP_COMMON_SAPI_FCCH,
+ [cOCTVC1_GSM_SAPI_ENUM_SCH] = L1SAP_COMMON_SAPI_SCH,
+ [cOCTVC1_GSM_SAPI_ENUM_SACCH] = L1SAP_COMMON_SAPI_SACCH,
+ [cOCTVC1_GSM_SAPI_ENUM_SDCCH] = L1SAP_COMMON_SAPI_SDCCH,
+ [cOCTVC1_GSM_SAPI_ENUM_BCCH] = L1SAP_COMMON_SAPI_BCCH,
+ [cOCTVC1_GSM_SAPI_ENUM_PCH_AGCH] = L1SAP_COMMON_SAPI_PCH,
+ [cOCTVC1_GSM_SAPI_ENUM_CBCH] = L1SAP_COMMON_SAPI_CBCH,
+ [cOCTVC1_GSM_SAPI_ENUM_RACH] = L1SAP_COMMON_SAPI_RACH,
+ [cOCTVC1_GSM_SAPI_ENUM_TCHF] = L1SAP_COMMON_SAPI_TCH_F,
+ [cOCTVC1_GSM_SAPI_ENUM_FACCHF] = L1SAP_COMMON_SAPI_FACCH_F,
+ [cOCTVC1_GSM_SAPI_ENUM_TCHH] = L1SAP_COMMON_SAPI_TCH_H,
+ [cOCTVC1_GSM_SAPI_ENUM_FACCHH] = L1SAP_COMMON_SAPI_FACCH_H,
+ [cOCTVC1_GSM_SAPI_ENUM_NCH] = L1SAP_COMMON_SAPI_NCH,
+ [cOCTVC1_GSM_SAPI_ENUM_PDTCH] = L1SAP_COMMON_SAPI_PDTCH,
+ [cOCTVC1_GSM_SAPI_ENUM_PACCH] = L1SAP_COMMON_SAPI_PACCH,
+ [cOCTVC1_GSM_SAPI_ENUM_PBCCH] = L1SAP_COMMON_SAPI_PBCCH,
+ [cOCTVC1_GSM_SAPI_ENUM_PAGCH] = L1SAP_COMMON_SAPI_PAGCH,
+ [cOCTVC1_GSM_SAPI_ENUM_PPCH] = L1SAP_COMMON_SAPI_PPCH,
+ [cOCTVC1_GSM_SAPI_ENUM_PNCH] = L1SAP_COMMON_SAPI_PNCH,
+ [cOCTVC1_GSM_SAPI_ENUM_PTCCH] = L1SAP_COMMON_SAPI_PTCCH,
+ [cOCTVC1_GSM_SAPI_ENUM_PRACH] = L1SAP_COMMON_SAPI_PRACH,
+};
+
+static enum l1sap_common_sapi get_common_sapi(tOCT_UINT8 sapi)
+{
+ if (sapi >= _OCTVC1_GSM_SAPI_ENUM_LENGTH)
+ return L1SAP_COMMON_SAPI_UNKNOWN;
+ return common_sapi_by_oct_sapi[sapi];
+}
+
+static void set_log_ctx_sapi(tOCT_UINT8 sapi)
+{
+ l1sap_log_ctx_sapi = get_common_sapi(sapi);
+ log_set_context(LOG_CTX_L1_SAPI, &l1sap_log_ctx_sapi);
+}
+
static int handle_ph_readytosend_ind(struct octphy_hdl *fl1,
tOCTVC1_GSM_MSG_TRX_LOGICAL_CHANNEL_READY_TO_SEND_INDICATION_EVT *evt,
struct msgb *l1p_msg)
@@ -955,6 +996,8 @@ static int handle_ph_readytosend_ind(struct octphy_hdl *fl1,
struct msgb *resp_msg;
tOCTVC1_GSM_MSG_TRX_REQUEST_LOGICAL_CHANNEL_DATA_CMD *data_req;
+ set_log_ctx_sapi(evt->LchId.bySAPI);
+
/* Retrive the data */
fn = evt->ulFrameNumber;
ts_num = (uint8_t) evt->LchId.byTimeslotNb;
@@ -1079,6 +1122,8 @@ static int handle_ph_data_ind(struct octphy_hdl *fl1,
uint8_t ts_num = (uint8_t) data_ind->LchId.byTimeslotNb;
uint8_t sc = (uint8_t) data_ind->LchId.bySubChannelNb;
+ set_log_ctx_sapi(data_ind->LchId.bySAPI);
+
/* Need to combine two 16bit MSB and LSB to form 32bit FN */
fn = data_ind->Data.ulFrameNumber;
@@ -1171,6 +1216,8 @@ static int handle_ph_rach_ind(struct octphy_hdl *fl1,
int rc;
struct ph_rach_ind_param rach_ind_param;
+ set_log_ctx_sapi(ra_ind->LchId.bySAPI);
+
dump_meas_res(LOGL_DEBUG, &ra_ind->MeasurementInfo);
if (ra_ind->ulMsgLength != 1) {
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index df39e2f4..199d8bd4 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -796,6 +796,45 @@ static uint8_t chan_nr_by_sapi(struct gsm_bts_trx_ts *ts,
return (cbits << 3) | u8Tn;
}
+static const enum l1sap_common_sapi common_sapi_by_sapi_t[] = {
+ [GsmL1_Sapi_Idle] = L1SAP_COMMON_SAPI_IDLE,
+ [GsmL1_Sapi_Fcch] = L1SAP_COMMON_SAPI_FCCH,
+ [GsmL1_Sapi_Sch] = L1SAP_COMMON_SAPI_SCH,
+ [GsmL1_Sapi_Sacch] = L1SAP_COMMON_SAPI_SACCH,
+ [GsmL1_Sapi_Sdcch] = L1SAP_COMMON_SAPI_SDCCH,
+ [GsmL1_Sapi_Bcch] = L1SAP_COMMON_SAPI_BCCH,
+ [GsmL1_Sapi_Pch] = L1SAP_COMMON_SAPI_PCH,
+ [GsmL1_Sapi_Agch] = L1SAP_COMMON_SAPI_AGCH,
+ [GsmL1_Sapi_Cbch] = L1SAP_COMMON_SAPI_CBCH,
+ [GsmL1_Sapi_Rach] = L1SAP_COMMON_SAPI_RACH,
+ [GsmL1_Sapi_TchF] = L1SAP_COMMON_SAPI_TCH_F,
+ [GsmL1_Sapi_FacchF] = L1SAP_COMMON_SAPI_FACCH_F,
+ [GsmL1_Sapi_TchH] = L1SAP_COMMON_SAPI_TCH_H,
+ [GsmL1_Sapi_FacchH] = L1SAP_COMMON_SAPI_FACCH_H,
+ [GsmL1_Sapi_Nch] = L1SAP_COMMON_SAPI_NCH,
+ [GsmL1_Sapi_Pdtch] = L1SAP_COMMON_SAPI_PDTCH,
+ [GsmL1_Sapi_Pacch] = L1SAP_COMMON_SAPI_PACCH,
+ [GsmL1_Sapi_Pbcch] = L1SAP_COMMON_SAPI_PBCCH,
+ [GsmL1_Sapi_Pagch] = L1SAP_COMMON_SAPI_PAGCH,
+ [GsmL1_Sapi_Ppch] = L1SAP_COMMON_SAPI_PPCH,
+ [GsmL1_Sapi_Pnch] = L1SAP_COMMON_SAPI_PNCH,
+ [GsmL1_Sapi_Ptcch] = L1SAP_COMMON_SAPI_PTCCH,
+ [GsmL1_Sapi_Prach] = L1SAP_COMMON_SAPI_PRACH,
+};
+
+static enum l1sap_common_sapi get_common_sapi(GsmL1_Sapi_t sapi)
+{
+ if (sapi >= GsmL1_Sapi_NUM)
+ return L1SAP_COMMON_SAPI_UNKNOWN;
+ return common_sapi_by_sapi_t[sapi];
+}
+
+static void set_log_ctx_sapi(GsmL1_Sapi_t sapi)
+{
+ l1sap_log_ctx_sapi = get_common_sapi(sapi);
+ log_set_context(LOG_CTX_L1_SAPI, &l1sap_log_ctx_sapi);
+}
+
static int handle_ph_readytosend_ind(struct femtol1_hdl *fl1,
GsmL1_PhReadyToSendInd_t *rts_ind,
struct msgb *l1p_msg)
@@ -812,6 +851,8 @@ static int handle_ph_readytosend_ind(struct femtol1_hdl *fl1,
uint8_t chan_nr, link_id;
uint32_t fn;
+ set_log_ctx_sapi(rts_ind->sapi);
+
/* check if primitive should be handled by common part */
chan_nr = chan_nr_by_sapi(&trx->ts[rts_ind->u8Tn], rts_ind->sapi,
rts_ind->subCh, rts_ind->u8Tn, rts_ind->u32Fn);
@@ -933,6 +974,8 @@ static int handle_ph_data_ind(struct femtol1_hdl *fl1, GsmL1_PhDataInd_t *data_i
struct gsm_time g_time;
int rc = 0;
+ set_log_ctx_sapi(data_ind->sapi);
+
chan_nr = chan_nr_by_sapi(&trx->ts[data_ind->u8Tn], data_ind->sapi,
data_ind->subCh, data_ind->u8Tn, data_ind->u32Fn);
if (!chan_nr) {
@@ -996,6 +1039,8 @@ static int handle_ph_ra_ind(struct femtol1_hdl *fl1, GsmL1_PhRaInd_t *ra_ind,
int rc;
struct ph_rach_ind_param rach_ind_param;
+ set_log_ctx_sapi(ra_ind->sapi);
+
dump_meas_res(LOGL_DEBUG, &ra_ind->measParam);
if ((ra_ind->msgUnitParam.u8Size != 1) &&