From de99be4afbc35e22f4f0263b0e9661dcecdc1ea2 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 30 Jul 2017 16:55:00 +0200 Subject: [PATCH] L1SAP: Use RSL_CHAN_OSMO_PDCH across L1SAP So far, L1SAP code is hiding RSL_CHAN_OSMO_PDCH from the bts specific code below L1SAP. This is some kind of a hack/workaround, making code and debug output / logs more difficult to understand. So let's teach the lower layer how to treat RSL_CHAN_OSMO_PDCH and remove the "hiding" code from the common l1sap.c code. Change-Id: Iaaa833febe45b82166d3901f10cc5466a7591c19 --- include/osmo-bts/l1sap.h | 1 + src/common/l1sap.c | 9 +++------ src/common/scheduler.c | 4 ++-- src/osmo-bts-litecell15/l1_if.c | 4 ++-- src/osmo-bts-octphy/l1_if.c | 4 ++-- src/osmo-bts-sysmo/l1_if.c | 4 ++-- 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/include/osmo-bts/l1sap.h b/include/osmo-bts/l1sap.h index 4e9c9e209..ad13145bf 100644 --- a/include/osmo-bts/l1sap.h +++ b/include/osmo-bts/l1sap.h @@ -22,6 +22,7 @@ #define L1SAP_IS_CHAN_BCCH(chan_nr) ((chan_nr & 0xf8) == 0x80) #define L1SAP_IS_CHAN_RACH(chan_nr) ((chan_nr & 0xf8) == 0x88) #define L1SAP_IS_CHAN_AGCH_PCH(chan_nr) ((chan_nr & 0xf8) == 0x90) +#define L1SAP_IS_CHAN_PDCH(chan_nr) ((chan_nr & 0xf8) == 0xc0) /* rach type from ra */ #define L1SAP_IS_PACKET_RACH(ra) ((ra & 0xf0) == 0x70 && (ra & 0x0f) != 0x0f) diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 7c6956198..4bf24a5d2 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -263,6 +263,8 @@ static int gsmtap_ph_data(struct osmo_phsap_prim *l1sap, uint8_t *chan_type, *chan_type = GSMTAP_CHANNEL_PCH; else *chan_type = GSMTAP_CHANNEL_AGCH; + } else if (L1SAP_IS_CHAN_PDCH(chan_nr)) { + *chan_type = GSMTAP_CHANNEL_PDTCH; } if (L1SAP_IS_LINK_SACCH(link_id)) *chan_type |= GSMTAP_CHANNEL_ACCH; @@ -1218,7 +1220,7 @@ int l1sap_pdch_req(struct gsm_bts_trx_ts *ts, int is_ptcch, uint32_t fn, l1sap = msgb_l1sap_prim(msg); osmo_prim_init(&l1sap->oph, SAP_GSM_PH, PRIM_PH_DATA, PRIM_OP_REQUEST, msg); - l1sap->u.data.chan_nr = 0x08 | ts->nr; + l1sap->u.data.chan_nr = RSL_CHAN_OSMO_PDCH | ts->nr; l1sap->u.data.link_id = 0x00; l1sap->u.data.fn = fn; msg->l2h = msgb_put(msg, len); @@ -1265,11 +1267,6 @@ static int l1sap_chan_act_dact_modify(struct gsm_bts_trx *trx, uint8_t chan_nr, { struct osmo_phsap_prim l1sap; - /* The caller may pass a non-standard RSL_CHAN_OSMO_PDCH, which the L1 - * doesn't understand. Use the normal TCH/F cbits instead. */ - if ((chan_nr & RSL_CHAN_NR_MASK) == RSL_CHAN_OSMO_PDCH) - chan_nr = RSL_CHAN_Bm_ACCHs | (chan_nr & ~RSL_CHAN_NR_MASK); - memset(&l1sap, 0, sizeof(l1sap)); osmo_prim_init(&l1sap.oph, SAP_GSM_PH, PRIM_MPH_INFO, PRIM_OP_REQUEST, NULL); diff --git a/src/common/scheduler.c b/src/common/scheduler.c index 08603d242..f6cb07e5f 100644 --- a/src/common/scheduler.c +++ b/src/common/scheduler.c @@ -152,8 +152,8 @@ const struct trx_chan_desc trx_chan_desc[_TRX_CHAN_MAX] = { { 0, TRXC_SACCH8_5, 0x68, LID_SACCH, "SACCH/8(5)", rts_data_fn, tx_data_fn, rx_data_fn, 0 }, { 0, TRXC_SACCH8_6, 0x70, LID_SACCH, "SACCH/8(6)", rts_data_fn, tx_data_fn, rx_data_fn, 0 }, { 0, TRXC_SACCH8_7, 0x78, LID_SACCH, "SACCH/8(7)", rts_data_fn, tx_data_fn, rx_data_fn, 0 }, - { 1, TRXC_PDTCH, 0x08, LID_DEDIC, "PDTCH", rts_data_fn, tx_pdtch_fn, rx_pdtch_fn, 0 }, - { 1, TRXC_PTCCH, 0x08, LID_DEDIC, "PTCCH", rts_data_fn, tx_data_fn, rx_data_fn, 0 }, + { 1, TRXC_PDTCH, 0xc0, LID_DEDIC, "PDTCH", rts_data_fn, tx_pdtch_fn, rx_pdtch_fn, 0 }, + { 1, TRXC_PTCCH, 0xc0, LID_DEDIC, "PTCCH", rts_data_fn, tx_data_fn, rx_data_fn, 0 }, }; const struct value_string trx_chan_type_names[] = { diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c index a3b9556bd..12c247010 100644 --- a/src/osmo-bts-litecell15/l1_if.c +++ b/src/osmo-bts-litecell15/l1_if.c @@ -358,9 +358,9 @@ static int ph_data_req(struct gsm_bts_trx *trx, struct msgb *msg, lchan = get_lchan_by_chan_nr(trx, chan_nr); if (L1SAP_IS_LINK_SACCH(link_id)) { sapi = GsmL1_Sapi_Sacch; - if (!L1SAP_IS_CHAN_TCHF(chan_nr)) + if (!L1SAP_IS_CHAN_TCHF(chan_nr) && !L1SAP_IS_CHAN_PDCH(chan_nr)) subCh = l1sap_chan2ss(chan_nr); - } else if (L1SAP_IS_CHAN_TCHF(chan_nr)) { + } else if (L1SAP_IS_CHAN_TCHF(chan_nr) || L1SAP_IS_CHAN_PDCH(chan_nr)) { if (ts_is_pdch(&trx->ts[u8Tn])) { if (L1SAP_IS_PTCCH(u32Fn)) { sapi = GsmL1_Sapi_Ptcch; diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c index 20a84f8d9..cb792d796 100644 --- a/src/osmo-bts-octphy/l1_if.c +++ b/src/osmo-bts-octphy/l1_if.c @@ -473,9 +473,9 @@ static int ph_data_req(struct gsm_bts_trx *trx, struct msgb *msg, subCh = 0xf1; if (L1SAP_IS_LINK_SACCH(link_id)) { sapi = cOCTVC1_GSM_SAPI_ENUM_SACCH; - if (!L1SAP_IS_CHAN_TCHF(chan_nr)) + if (!L1SAP_IS_CHAN_TCHF(chan_nr) && !L1SAP_IS_CHAN_PDCH(chan_nr)) subCh = l1sap_chan2ss(chan_nr); - } else if (L1SAP_IS_CHAN_TCHF(chan_nr)) { + } else if (L1SAP_IS_CHAN_TCHF(chan_nr) || L1SAP_IS_CHAN_PDCH(chan_nr)) { if (trx->ts[u8Tn].pchan == GSM_PCHAN_PDCH) { if (L1SAP_IS_PTCCH(u32Fn)) { sapi = cOCTVC1_GSM_SAPI_ENUM_PTCCH; diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c index 781900ee8..8f68210e4 100644 --- a/src/osmo-bts-sysmo/l1_if.c +++ b/src/osmo-bts-sysmo/l1_if.c @@ -354,9 +354,9 @@ static int ph_data_req(struct gsm_bts_trx *trx, struct msgb *msg, lchan = get_lchan_by_chan_nr(trx, chan_nr); if (L1SAP_IS_LINK_SACCH(link_id)) { sapi = GsmL1_Sapi_Sacch; - if (!L1SAP_IS_CHAN_TCHF(chan_nr)) + if (!L1SAP_IS_CHAN_TCHF(chan_nr) && !L1SAP_IS_CHAN_PDCH(chan_nr)) subCh = l1sap_chan2ss(chan_nr); - } else if (L1SAP_IS_CHAN_TCHF(chan_nr)) { + } else if (L1SAP_IS_CHAN_TCHF(chan_nr) || L1SAP_IS_CHAN_PDCH(chan_nr)) { if (ts_is_pdch(&trx->ts[u8Tn])) { if (L1SAP_IS_PTCCH(u32Fn)) { sapi = GsmL1_Sapi_Ptcch;