dexter has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-pcu/+/31362 )
Change subject: pcu_l1_if: get rid of l1if checks
......................................................................
pcu_l1_if: get rid of l1if checks
At the moment we check for the presence of l1if and skip calling the
driver related function. Instead, the driver function should check the
presence of l1if.
Change-Id: I54c5de04382e0bd0dbbf233eaffb403fc492d070
---
M src/osmo-bts-litecell15/lc15_l1_if.c
M src/osmo-bts-oc2g/oc2g_l1_if.c
M src/osmo-bts-sysmo/sysmo_l1_if.c
M src/osmobts_sock.c
M src/pcu_l1_if.cpp
5 files changed, 39 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/62/31362/1
diff --git a/src/osmo-bts-litecell15/lc15_l1_if.c b/src/osmo-bts-litecell15/lc15_l1_if.c
index 18e9c17..0a53120 100644
--- a/src/osmo-bts-litecell15/lc15_l1_if.c
+++ b/src/osmo-bts-litecell15/lc15_l1_if.c
@@ -135,9 +135,15 @@
static int l1if_connect_pdch(void *obj, uint8_t ts)
{
struct lc15l1_hdl *fl1h = obj;
- struct msgb *msg = l1p_msgb_alloc();
+ struct msgb *msg;
GsmL1_MphConnectReq_t *cr;
+ if (!fl1h) {
+ LOGP(DL1IF, LOGL_ERROR, "no fl1h context, cannot open PDCH for TS=%u
yet...\n", ts);
+ return -EINVAL;
+ }
+
+ msg = l1p_msgb_alloc();
cr = prim_init(msgb_l1prim(msg), GsmL1_PrimId_MphConnectReq, fl1h);
cr->u8Tn = ts;
cr->logChComb = GsmL1_LogChComb_XIII;
@@ -333,6 +339,11 @@
GsmL1_MsgUnitParam_t *msu_param;
struct gsm_time g_time;
+ if (!fl1h) {
+ LOGP(DL1IF, LOGL_ERROR, "no fl1h context, tosseing mac block for TS=%u...\n",
ts);
+ return -EINVAL;
+ }
+
gsm_fn2gsmtime(&g_time, fn);
DEBUGP(DL1IF, "TX packet data %02u/%02u/%02u is_ptcch=%d ts=%d "
diff --git a/src/osmo-bts-oc2g/oc2g_l1_if.c b/src/osmo-bts-oc2g/oc2g_l1_if.c
index ded3a3e..4d5b865 100644
--- a/src/osmo-bts-oc2g/oc2g_l1_if.c
+++ b/src/osmo-bts-oc2g/oc2g_l1_if.c
@@ -136,9 +136,15 @@
static int l1if_connect_pdch(void *obj, uint8_t ts)
{
struct oc2gl1_hdl *fl1h = obj;
- struct msgb *msg = l1p_msgb_alloc();
+ struct msgb *msg;
GsmL1_MphConnectReq_t *cr;
+ if (!fl1h) {
+ LOGP(DL1IF, LOGL_ERROR, "no fl1h context, cannot open PDCH for TS=%u
yet...\n", ts);
+ return -EINVAL;
+ }
+
+ msg = l1p_msgb_alloc();
cr = prim_init(msgb_l1prim(msg), GsmL1_PrimId_MphConnectReq, fl1h);
cr->u8Tn = ts;
cr->logChComb = GsmL1_LogChComb_XIII;
@@ -332,6 +338,11 @@
GsmL1_MsgUnitParam_t *msu_param;
struct gsm_time g_time;
+ if (!fl1h) {
+ LOGP(DL1IF, LOGL_ERROR, "no fl1h context, tosseing mac block for TS=%u...\n",
ts);
+ return -EINVAL;
+ }
+
gsm_fn2gsmtime(&g_time, fn);
DEBUGP(DL1IF, "TX packet data %02u/%02u/%02u is_ptcch=%d ts=%d "
diff --git a/src/osmo-bts-sysmo/sysmo_l1_if.c b/src/osmo-bts-sysmo/sysmo_l1_if.c
index 625c5b1..3ada98b 100644
--- a/src/osmo-bts-sysmo/sysmo_l1_if.c
+++ b/src/osmo-bts-sysmo/sysmo_l1_if.c
@@ -118,9 +118,15 @@
static int l1if_connect_pdch(void *obj, uint8_t ts)
{
struct femtol1_hdl *fl1h = obj;
- struct msgb *msg = l1p_msgb_alloc();
+ struct msgb *msg;
GsmL1_MphConnectReq_t *cr;
+ if (!fl1h) {
+ LOGP(DL1IF, LOGL_ERROR, "no fl1h context, cannot open PDCH for TS=%u
yet...\n", ts);
+ return -EINVAL;
+ }
+
+ msg = l1p_msgb_alloc();
cr = prim_init(msgb_l1prim(msg), GsmL1_PrimId_MphConnectReq, fl1h);
cr->u8Tn = ts;
cr->logChComb = GsmL1_LogChComb_XIII;
@@ -318,6 +324,11 @@
GsmL1_MsgUnitParam_t *msu_param;
struct gsm_time g_time;
+ if (!fl1h) {
+ LOGP(DL1IF, LOGL_ERROR, "no fl1h context, tosseing mac block for TS=%u...\n",
ts);
+ return -EINVAL;
+ }
+
gsm_fn2gsmtime(&g_time, fn);
DEBUGP(DL1IF, "TX packet data %02u/%02u/%02u is_ptcch=%d ts=%d "
diff --git a/src/osmobts_sock.c b/src/osmobts_sock.c
index d6fedb5..b4cf9aa 100644
--- a/src/osmobts_sock.c
+++ b/src/osmobts_sock.c
@@ -110,7 +110,7 @@
/* disable all slots, kick all TBFs */
for (trx = 0; trx < 8; trx++) {
/* Direct PHY access */
- if (the_pcu->phy_ops && bts->trx[trx].fl1h) {
+ if (the_pcu->phy_ops) {
the_pcu->phy_ops->l1if_close_pdch(bts->trx[trx].fl1h);
bts->trx[trx].fl1h = NULL;
}
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index a5ab081..6706283 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -212,7 +212,7 @@
uint32_t fn, uint8_t block_nr)
{
/* Direct PHY access */
- if (the_pcu->phy_ops && bts->trx[trx].fl1h) {
+ if (the_pcu->phy_ops) {
if (!msg) /* Simply skip sending idle frames to L1 */
return;
the_pcu->phy_ops->l1if_pdch_req(bts->trx[trx].fl1h, ts, 0, fn, arfcn,
block_nr,
@@ -241,7 +241,7 @@
gsmtap_send(the_pcu->gsmtap, arfcn, ts, GSMTAP_CHANNEL_PTCCH, 0, fn, 0, 0, data,
data_len);
/* Direct PHY access */
- if (the_pcu->phy_ops && bts->trx[trx].fl1h) {
+ if (the_pcu->phy_ops) {
if (!data_len) /* Simply skip sending idle frames to L1 */
return;
the_pcu->phy_ops->l1if_pdch_req(bts->trx[trx].fl1h, ts, 1, fn, arfcn,
block_nr, data, data_len);
--
To view, visit
https://gerrit.osmocom.org/c/osmo-pcu/+/31362
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I54c5de04382e0bd0dbbf233eaffb403fc492d070
Gerrit-Change-Number: 31362
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newchange