gerrit-log
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
November 2022
- 2 participants
- 2503 discussions
Change in osmo-mgw[master]: Add realtime scheduling and set priority in service file
by msuraev 12 Nov '22
by msuraev 12 Nov '22
12 Nov '22
Attention is currently required from: fixeria, pespin.
Hello Jenkins Builder, laforge, pespin, fixeria,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-mgw/+/30041
to look at the new patch set (#4).
Change subject: Add realtime scheduling and set priority in service file
......................................................................
Add realtime scheduling and set priority in service file
This sets lowest realtime priority which still takes precedence over any non-realtime service.
Related: OS#5687
Change-Id: Ib1705a164b04b876f129a17c4e8353b9ddcc538e
---
M contrib/systemd/osmo-mgw.service
1 file changed, 5 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/41/30041/4
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/30041
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Ib1705a164b04b876f129a17c4e8353b9ddcc538e
Gerrit-Change-Number: 30041
Gerrit-PatchSet: 4
Gerrit-Owner: msuraev <msuraev(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newpatchset
1
0
Change in osmo-mgw[master]: Add realtime scheduling and set priority in service file
by msuraev 12 Nov '22
by msuraev 12 Nov '22
12 Nov '22
Attention is currently required from: fixeria, pespin.
Hello Jenkins Builder, laforge, pespin, fixeria,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-mgw/+/30041
to look at the new patch set (#3).
Change subject: Add realtime scheduling and set priority in service file
......................................................................
Add realtime scheduling and set priority in service file
This sets lowest realtime priority which still takes precedence over any non-realtime service.
Related: OS#5687
Change-Id: Ib1705a164b04b876f129a17c4e8353b9ddcc538e
---
M contrib/systemd/osmo-mgw.service
1 file changed, 6 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/41/30041/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/30041
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Ib1705a164b04b876f129a17c4e8353b9ddcc538e
Gerrit-Change-Number: 30041
Gerrit-PatchSet: 3
Gerrit-Owner: msuraev <msuraev(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newpatchset
1
0
Change in osmocom-bb[master]: trxcon: turn libtrxcon into shared library libosmo-trxcon
by fixeria 12 Nov '22
by fixeria 12 Nov '22
12 Nov '22
Attention is currently required from: fixeria.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmocom-bb/+/30105
to look at the new patch set (#2).
Change subject: trxcon: turn libtrxcon into shared library libosmo-trxcon
......................................................................
trxcon: turn libtrxcon into shared library libosmo-trxcon
Change-Id: I508292e76c81ba7bc0c35db391a8622c46bdbe41
Related: OS#5599
---
M src/host/trxcon/include/osmocom/bb/trxcon/Makefile.am
M src/host/trxcon/src/Makefile.am
2 files changed, 23 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/05/30105/2
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/30105
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I508292e76c81ba7bc0c35db391a8622c46bdbe41
Gerrit-Change-Number: 30105
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newpatchset
1
0
Change in osmocom-bb[master]: trxcon: turn libtrxcon into shared library libosmo-trxcon
by fixeria 12 Nov '22
by fixeria 12 Nov '22
12 Nov '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/30105 )
Change subject: trxcon: turn libtrxcon into shared library libosmo-trxcon
......................................................................
trxcon: turn libtrxcon into shared library libosmo-trxcon
Change-Id: I508292e76c81ba7bc0c35db391a8622c46bdbe41
Related: OS#5599
---
M src/host/trxcon/include/osmocom/bb/trxcon/Makefile.am
M src/host/trxcon/src/Makefile.am
2 files changed, 21 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/05/30105/1
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/Makefile.am b/src/host/trxcon/include/osmocom/bb/trxcon/Makefile.am
index 1310a43..e39d07a 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/Makefile.am
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/Makefile.am
@@ -1,9 +1,14 @@
+trxcon_HEADERS = \
+ trxcon.h \
+ phyif.h \
+ $(NULL)
+
noinst_HEADERS = \
l1ctl_proto.h \
l1ctl_server.h \
l1ctl.h \
- phyif.h \
trx_if.h \
logging.h \
- trxcon.h \
$(NULL)
+
+trxcondir = $(includedir)/osmocom/trxcon
diff --git a/src/host/trxcon/src/Makefile.am b/src/host/trxcon/src/Makefile.am
index 34b7a3c..c9355ac 100644
--- a/src/host/trxcon/src/Makefile.am
+++ b/src/host/trxcon/src/Makefile.am
@@ -1,3 +1,8 @@
+# This is _NOT_ the library release version, it's an API version.
+# Please read Chapter 6 "Library interface versions" of the libtool
+# documentation before making any modification
+LIBVERSION=0:0:0
+
AM_CPPFLAGS = \
$(all_includes) \
-I$(top_srcdir)/include \
@@ -35,21 +40,26 @@
$(NULL)
-noinst_LTLIBRARIES += libtrxcon.la
+lib_LTLIBRARIES = libosmo-trxcon.la
-libtrxcon_la_SOURCES = \
+libosmo_trxcon_la_SOURCES = \
trxcon_inst.c \
trxcon_fsm.c \
trxcon_shim.c \
l1ctl.c \
$(NULL)
-libtrxcon_la_LIBADD = \
+libosmo_trxcon_la_LIBADD = \
libl1sched.la \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(NULL)
+libosmo_trxcon_la_LDFLAGS = \
+ -export-symbols-regex '^osmo_' \
+ -version-info $(LIBVERSION) \
+ $(NULL)
+
bin_PROGRAMS = trxcon
@@ -61,5 +71,5 @@
$(NULL)
trxcon_LDADD = \
- libtrxcon.la \
+ libosmo-trxcon.la \
$(NULL)
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/30105
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I508292e76c81ba7bc0c35db391a8622c46bdbe41
Gerrit-Change-Number: 30105
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange
1
0
Change in osmocom-bb[master]: trxcon: move shim l1sched/phyif API to libtrxcon.la
by fixeria 12 Nov '22
by fixeria 12 Nov '22
12 Nov '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/30103 )
Change subject: trxcon: move shim l1sched/phyif API to libtrxcon.la
......................................................................
trxcon: move shim l1sched/phyif API to libtrxcon.la
Change-Id: I56701b471a6f1c30ffd107037c2b1aed65621b2c
Related: OS#5599
---
M src/host/trxcon/include/osmocom/bb/trxcon/phyif.h
M src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
M src/host/trxcon/src/Makefile.am
M src/host/trxcon/src/trx_if.c
M src/host/trxcon/src/trxcon_main.c
A src/host/trxcon/src/trxcon_shim.c
6 files changed, 273 insertions(+), 239 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/03/30103/1
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h b/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h
index de6c3fd..132cd9b 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h
@@ -89,8 +89,8 @@
};
-int osmo_trxcon_phyif_handle_bi(void *phyif, const struct osmo_trxcon_phyif_bi *bi);
+int osmo_trxcon_phyif_handle_bi(void *priv, const struct osmo_trxcon_phyif_bi *bi);
int osmo_trxcon_phyif_handle_br(void *phyif, const struct osmo_trxcon_phyif_br *br);
int osmo_trxcon_phyif_handle_cmd(void *phyif, const struct osmo_trxcon_phyif_cmd *cmd);
-int osmo_trxcon_phyif_handle_rsp(void *phyif, const struct osmo_trxcon_phyif_rsp *rsp);
+int osmo_trxcon_phyif_handle_rsp(void *priv, const struct osmo_trxcon_phyif_rsp *rsp);
void osmo_trxcon_phyif_close(void *phyif);
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
index b3966bf..098609e 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
@@ -13,6 +13,9 @@
/* Logging context for sched and l1c */
const char *log_prefix;
+ /* GSMTAP instance (optional) */
+ struct gsmtap_inst *gsmtap;
+
/* The L1 scheduler */
struct l1sched_state *sched;
/* PHY interface (e.g. TRXC/TRXD) */
diff --git a/src/host/trxcon/src/Makefile.am b/src/host/trxcon/src/Makefile.am
index e0ce6a2..34b7a3c 100644
--- a/src/host/trxcon/src/Makefile.am
+++ b/src/host/trxcon/src/Makefile.am
@@ -40,6 +40,7 @@
libtrxcon_la_SOURCES = \
trxcon_inst.c \
trxcon_fsm.c \
+ trxcon_shim.c \
l1ctl.c \
$(NULL)
diff --git a/src/host/trxcon/src/trx_if.c b/src/host/trxcon/src/trx_if.c
index cc0599f..b00b34b 100644
--- a/src/host/trxcon/src/trx_if.c
+++ b/src/host/trxcon/src/trx_if.c
@@ -390,7 +390,7 @@
},
};
- osmo_trxcon_phyif_handle_rsp(trx, &rsp);
+ osmo_trxcon_phyif_handle_rsp(trx->priv, &rsp);
}
/*
@@ -676,7 +676,7 @@
"RX burst tn=%u fn=%u rssi=%d toa=%d\n",
bi.tn, bi.fn, bi.rssi, bi.toa256);
- return osmo_trxcon_phyif_handle_bi(trx, &bi);
+ return osmo_trxcon_phyif_handle_bi(trx->priv, &bi);
}
int trx_if_handle_phyif_br(struct trx_instance *trx,
diff --git a/src/host/trxcon/src/trxcon_main.c b/src/host/trxcon/src/trxcon_main.c
index ebdc3b2..440bc0f 100644
--- a/src/host/trxcon/src/trxcon_main.c
+++ b/src/host/trxcon/src/trxcon_main.c
@@ -48,7 +48,6 @@
#include <osmocom/bb/trxcon/logging.h>
#include <osmocom/bb/trxcon/l1ctl.h>
#include <osmocom/bb/trxcon/l1ctl_server.h>
-#include <osmocom/bb/l1sched/l1sched.h>
#define COPYRIGHT \
"Copyright (C) 2016-2022 by Vadim Yanitskiy <axilirator(a)gmail.com>\n" \
@@ -87,87 +86,6 @@
static void *tall_trxcon_ctx = NULL;
-static void trxcon_gsmtap_send(const struct l1sched_lchan_desc *lchan_desc,
- uint32_t fn, uint8_t tn, uint16_t band_arfcn,
- int8_t signal_dbm, uint8_t snr,
- const uint8_t *data, size_t data_len)
-{
- /* GSMTAP logging may be not enabled */
- if (app_data.gsmtap == NULL)
- return;
-
- /* Omit frames with unknown channel type */
- if (lchan_desc->gsmtap_chan_type == GSMTAP_CHANNEL_UNKNOWN)
- return;
-
- /* TODO: distinguish GSMTAP_CHANNEL_PCH and GSMTAP_CHANNEL_AGCH */
- gsmtap_send(app_data.gsmtap, band_arfcn, tn, lchan_desc->gsmtap_chan_type,
- lchan_desc->ss_nr, fn, signal_dbm, snr, data, data_len);
-}
-
-/* External L1 API for the scheduler */
-int l1sched_handle_config_req(struct l1sched_state *sched,
- const struct l1sched_config_req *cr)
-{
- struct osmo_trxcon_inst *trxcon = sched->priv;
-
- switch (cr->type) {
- case L1SCHED_CFG_PCHAN_COMB:
- {
- struct trxcon_param_set_phy_config_req req = {
- .type = TRXCON_PHY_CFGT_PCHAN_COMB,
- .pchan_comb = {
- .tn = cr->pchan_comb.tn,
- .pchan = cr->pchan_comb.pchan,
- },
- };
-
- return osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_SET_PHY_CONFIG_REQ, &req);
- }
- default:
- LOGPFSML(trxcon->fi, LOGL_ERROR,
- "Unhandled config request (type 0x%02x)\n", cr->type);
- return -ENODEV;
- }
-}
-
-int l1sched_handle_burst_req(struct l1sched_state *sched,
- const struct l1sched_burst_req *br)
-{
- struct osmo_trxcon_inst *trxcon = sched->priv;
- const struct osmo_trxcon_phyif_br phybr = {
- .fn = br->fn,
- .tn = br->tn,
- .pwr = br->pwr,
- .burst = &br->burst[0],
- .burst_len = br->burst_len,
- };
-
- return osmo_trxcon_phyif_handle_br(trxcon->phyif, &phybr);
-}
-
-/* External L1 API for the PHYIF */
-int osmo_trxcon_phyif_handle_bi(void *phyif, const struct osmo_trxcon_phyif_bi *bi)
-{
- struct trx_instance *trx = phyif;
- struct osmo_trxcon_inst *trxcon = trx->priv;
- const struct l1sched_meas_set meas = {
- .fn = bi->fn,
- .toa256 = bi->toa256,
- .rssi = bi->rssi,
- };
-
- /* Poke scheduler */
- l1sched_handle_rx_burst(trxcon->sched, bi->tn, bi->fn,
- bi->burst, bi->burst_len, &meas);
-
- /* Correct local clock counter */
- if (bi->fn % 51 == 0)
- l1sched_clck_handle(trxcon->sched, bi->fn);
-
- return 0;
-}
-
int osmo_trxcon_phyif_handle_br(void *phyif, const struct osmo_trxcon_phyif_br *br)
{
return trx_if_handle_phyif_br(phyif, br);
@@ -178,164 +96,11 @@
return trx_if_handle_phyif_cmd(phyif, cmd);
}
-int osmo_trxcon_phyif_handle_rsp(void *phyif, const struct osmo_trxcon_phyif_rsp *rsp)
-{
- struct trx_instance *trx = phyif;
- struct osmo_trxcon_inst *trxcon = trx->priv;
-
- switch (rsp->type) {
- case OSMO_TRXCON_PHYIF_CMDT_MEASURE:
- {
- const struct osmo_trxcon_phyif_rspp_measure *meas = &rsp->param.measure;
- struct trxcon_param_full_power_scan_res res = {
- .band_arfcn = meas->band_arfcn,
- .dbm = meas->dbm,
- };
-
- return osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_FULL_POWER_SCAN_RES, &res);
- }
- default:
- LOGPFSML(trxcon->fi, LOGL_ERROR,
- "Unhandled PHYIF response (type 0x%02x)\n", rsp->type);
- return -ENODEV;
- }
-}
-
void osmo_trxcon_phyif_close(void *phyif)
{
trx_if_close(phyif);
}
-/* External L2 API for the scheduler */
-int l1sched_handle_data_ind(struct l1sched_lchan_state *lchan,
- const uint8_t *data, size_t data_len,
- int n_errors, int n_bits_total,
- enum l1sched_data_type dt)
-{
- const struct l1sched_meas_set *meas = &lchan->meas_avg;
- const struct l1sched_lchan_desc *lchan_desc;
- struct l1sched_state *sched = lchan->ts->sched;
- struct osmo_trxcon_inst *trxcon = sched->priv;
- int rc;
-
- lchan_desc = &l1sched_lchan_desc[lchan->type];
-
- struct trxcon_param_rx_data_ind ind = {
- /* .traffic is set below */
- .chan_nr = lchan_desc->chan_nr | lchan->ts->index,
- .link_id = lchan_desc->link_id,
- .band_arfcn = trxcon->l1p.band_arfcn,
- .frame_nr = meas->fn,
- .toa256 = meas->toa256,
- .rssi = meas->rssi,
- .n_errors = n_errors,
- .n_bits_total = n_bits_total,
- .data_len = data_len,
- .data = data,
- };
-
- switch (dt) {
- case L1SCHED_DT_PACKET_DATA:
- case L1SCHED_DT_TRAFFIC:
- ind.traffic = true;
- /* fall-through */
- case L1SCHED_DT_SIGNALING:
- rc = osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_RX_DATA_IND, &ind);
- break;
- case L1SCHED_DT_OTHER:
- if (lchan->type == L1SCHED_SCH) {
- if (trxcon->fi->state != TRXCON_ST_FBSB_SEARCH)
- return 0;
- rc = osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_FBSB_SEARCH_RES, NULL);
- break;
- }
- /* fall through */
- default:
- LOGPFSML(trxcon->fi, LOGL_ERROR,
- "Unhandled L2 DATA.ind (type 0x%02x)\n", dt);
- return -ENODEV;
- }
-
- if (data != NULL && data_len > 0) {
- trxcon_gsmtap_send(lchan_desc, meas->fn, lchan->ts->index,
- trxcon->l1p.band_arfcn, meas->rssi, 0,
- data, data_len);
- }
-
- return rc;
-}
-
-int l1sched_handle_data_cnf(struct l1sched_lchan_state *lchan,
- uint32_t fn, enum l1sched_data_type dt)
-{
- const struct l1sched_lchan_desc *lchan_desc;
- struct l1sched_state *sched = lchan->ts->sched;
- struct osmo_trxcon_inst *trxcon = sched->priv;
- bool is_traffic = false;
- const uint8_t *data;
- uint8_t ra_buf[2];
- size_t data_len;
- int rc;
-
- lchan_desc = &l1sched_lchan_desc[lchan->type];
-
- switch (dt) {
- case L1SCHED_DT_TRAFFIC:
- case L1SCHED_DT_PACKET_DATA:
- is_traffic = true;
- /* fall-through */
- case L1SCHED_DT_SIGNALING:
- {
- struct trxcon_param_tx_data_cnf cnf = {
- .traffic = is_traffic,
- .chan_nr = lchan_desc->chan_nr | lchan->ts->index,
- .link_id = lchan_desc->link_id,
- .band_arfcn = trxcon->l1p.band_arfcn,
- .frame_nr = fn,
- };
-
- rc = osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_TX_DATA_CNF, &cnf);
- data_len = lchan->prim->payload_len;
- data = lchan->prim->payload;
- break;
- }
- case L1SCHED_DT_OTHER:
- if (L1SCHED_PRIM_IS_RACH(lchan->prim)) {
- const struct l1sched_ts_prim_rach *rach;
- struct trxcon_param_tx_access_burst_cnf cnf = {
- .band_arfcn = trxcon->l1p.band_arfcn,
- .frame_nr = fn,
- };
-
- rc = osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_TX_ACCESS_BURST_CNF, &cnf);
-
- rach = (struct l1sched_ts_prim_rach *)lchan->prim->payload;
- if (lchan->prim->type == L1SCHED_PRIM_RACH11) {
- ra_buf[0] = (uint8_t)(rach->ra >> 3);
- ra_buf[1] = (uint8_t)(rach->ra & 0x07);
- data = &ra_buf[0];
- data_len = 2;
- } else {
- ra_buf[0] = (uint8_t)(rach->ra);
- data = &ra_buf[0];
- data_len = 1;
- }
- break;
- }
- /* fall through */
- default:
- LOGPFSML(trxcon->fi, LOGL_ERROR,
- "Unhandled L2 DATA.cnf (type 0x%02x)\n", dt);
- return -ENODEV;
- }
-
- trxcon_gsmtap_send(lchan_desc, fn, lchan->ts->index,
- trxcon->l1p.band_arfcn | ARFCN_UPLINK,
- 0, 0, data, data_len);
-
- return rc;
-}
-
void osmo_trxcon_l1ctl_close(struct osmo_trxcon_inst *trxcon)
{
/* Avoid use-after-free: both *fi and *trxcon are children of
@@ -391,6 +156,8 @@
osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_PHYIF_FAILURE, NULL);
return;
}
+
+ trxcon->gsmtap = app_data.gsmtap;
}
static void l1ctl_conn_close_cb(struct l1ctl_client *l1c)
diff --git a/src/host/trxcon/src/trxcon_shim.c b/src/host/trxcon/src/trxcon_shim.c
new file mode 100644
index 0000000..47e5cea
--- /dev/null
+++ b/src/host/trxcon/src/trxcon_shim.c
@@ -0,0 +1,263 @@
+/*
+ * OsmocomBB <-> SDR connection bridge
+ *
+ * (C) 2022 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de>
+ * Author: Vadim Yanitskiy <vyanitskiy(a)sysmocom.de>
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <stdint.h>
+#include <errno.h>
+
+#include <osmocom/core/fsm.h>
+#include <osmocom/core/gsmtap_util.h>
+#include <osmocom/core/gsmtap.h>
+
+#include <osmocom/bb/trxcon/trxcon.h>
+#include <osmocom/bb/trxcon/trxcon_fsm.h>
+#include <osmocom/bb/trxcon/phyif.h>
+#include <osmocom/bb/l1sched/l1sched.h>
+
+static void trxcon_gsmtap_send(struct gsmtap_inst *gi, uint8_t chan_type,
+ uint32_t fn, uint8_t tn, uint8_t ss,
+ uint16_t band_arfcn,
+ int8_t signal_dbm, uint8_t snr,
+ const uint8_t *data, size_t data_len)
+{
+ /* Omit frames with unknown channel type */
+ if (chan_type == GSMTAP_CHANNEL_UNKNOWN)
+ return;
+
+ /* TODO: distinguish GSMTAP_CHANNEL_PCH and GSMTAP_CHANNEL_AGCH */
+ gsmtap_send(gi, band_arfcn, tn, chan_type, ss, fn, signal_dbm, snr, data, data_len);
+}
+
+/* External L1 API for the scheduler */
+int l1sched_handle_config_req(struct l1sched_state *sched,
+ const struct l1sched_config_req *cr)
+{
+ struct osmo_trxcon_inst *trxcon = sched->priv;
+
+ switch (cr->type) {
+ case L1SCHED_CFG_PCHAN_COMB:
+ {
+ struct trxcon_param_set_phy_config_req req = {
+ .type = TRXCON_PHY_CFGT_PCHAN_COMB,
+ .pchan_comb = {
+ .tn = cr->pchan_comb.tn,
+ .pchan = cr->pchan_comb.pchan,
+ },
+ };
+
+ return osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_SET_PHY_CONFIG_REQ, &req);
+ }
+ default:
+ LOGPFSML(trxcon->fi, LOGL_ERROR,
+ "Unhandled config request (type 0x%02x)\n", cr->type);
+ return -ENODEV;
+ }
+}
+
+int l1sched_handle_burst_req(struct l1sched_state *sched,
+ const struct l1sched_burst_req *br)
+{
+ struct osmo_trxcon_inst *trxcon = sched->priv;
+ const struct osmo_trxcon_phyif_br phybr = {
+ .fn = br->fn,
+ .tn = br->tn,
+ .pwr = br->pwr,
+ .burst = &br->burst[0],
+ .burst_len = br->burst_len,
+ };
+
+ return osmo_trxcon_phyif_handle_br(trxcon->phyif, &phybr);
+}
+
+/* External L2 API for the scheduler */
+int l1sched_handle_data_ind(struct l1sched_lchan_state *lchan,
+ const uint8_t *data, size_t data_len,
+ int n_errors, int n_bits_total,
+ enum l1sched_data_type dt)
+{
+ const struct l1sched_meas_set *meas = &lchan->meas_avg;
+ const struct l1sched_lchan_desc *lchan_desc;
+ struct l1sched_state *sched = lchan->ts->sched;
+ struct osmo_trxcon_inst *trxcon = sched->priv;
+ int rc;
+
+ lchan_desc = &l1sched_lchan_desc[lchan->type];
+
+ struct trxcon_param_rx_data_ind ind = {
+ /* .traffic is set below */
+ .chan_nr = lchan_desc->chan_nr | lchan->ts->index,
+ .link_id = lchan_desc->link_id,
+ .band_arfcn = trxcon->l1p.band_arfcn,
+ .frame_nr = meas->fn,
+ .toa256 = meas->toa256,
+ .rssi = meas->rssi,
+ .n_errors = n_errors,
+ .n_bits_total = n_bits_total,
+ .data_len = data_len,
+ .data = data,
+ };
+
+ switch (dt) {
+ case L1SCHED_DT_PACKET_DATA:
+ case L1SCHED_DT_TRAFFIC:
+ ind.traffic = true;
+ /* fall-through */
+ case L1SCHED_DT_SIGNALING:
+ rc = osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_RX_DATA_IND, &ind);
+ break;
+ case L1SCHED_DT_OTHER:
+ if (lchan->type == L1SCHED_SCH) {
+ if (trxcon->fi->state != TRXCON_ST_FBSB_SEARCH)
+ return 0;
+ rc = osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_FBSB_SEARCH_RES, NULL);
+ break;
+ }
+ /* fall through */
+ default:
+ LOGPFSML(trxcon->fi, LOGL_ERROR,
+ "Unhandled L2 DATA.ind (type 0x%02x)\n", dt);
+ return -ENODEV;
+ }
+
+ if (trxcon->gsmtap != NULL && data != NULL && data_len > 0) {
+ trxcon_gsmtap_send(trxcon->gsmtap, lchan_desc->gsmtap_chan_type,
+ meas->fn, lchan->ts->index, lchan_desc->ss_nr,
+ trxcon->l1p.band_arfcn, meas->rssi, 0,
+ data, data_len);
+ }
+
+ return rc;
+}
+
+int l1sched_handle_data_cnf(struct l1sched_lchan_state *lchan,
+ uint32_t fn, enum l1sched_data_type dt)
+{
+ const struct l1sched_lchan_desc *lchan_desc;
+ struct l1sched_state *sched = lchan->ts->sched;
+ struct osmo_trxcon_inst *trxcon = sched->priv;
+ bool is_traffic = false;
+ const uint8_t *data;
+ uint8_t ra_buf[2];
+ size_t data_len;
+ int rc;
+
+ lchan_desc = &l1sched_lchan_desc[lchan->type];
+
+ switch (dt) {
+ case L1SCHED_DT_TRAFFIC:
+ case L1SCHED_DT_PACKET_DATA:
+ is_traffic = true;
+ /* fall-through */
+ case L1SCHED_DT_SIGNALING:
+ {
+ struct trxcon_param_tx_data_cnf cnf = {
+ .traffic = is_traffic,
+ .chan_nr = lchan_desc->chan_nr | lchan->ts->index,
+ .link_id = lchan_desc->link_id,
+ .band_arfcn = trxcon->l1p.band_arfcn,
+ .frame_nr = fn,
+ };
+
+ rc = osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_TX_DATA_CNF, &cnf);
+ data_len = lchan->prim->payload_len;
+ data = lchan->prim->payload;
+ break;
+ }
+ case L1SCHED_DT_OTHER:
+ if (L1SCHED_PRIM_IS_RACH(lchan->prim)) {
+ const struct l1sched_ts_prim_rach *rach;
+ struct trxcon_param_tx_access_burst_cnf cnf = {
+ .band_arfcn = trxcon->l1p.band_arfcn,
+ .frame_nr = fn,
+ };
+
+ rc = osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_TX_ACCESS_BURST_CNF, &cnf);
+
+ rach = (struct l1sched_ts_prim_rach *)lchan->prim->payload;
+ if (lchan->prim->type == L1SCHED_PRIM_RACH11) {
+ ra_buf[0] = (uint8_t)(rach->ra >> 3);
+ ra_buf[1] = (uint8_t)(rach->ra & 0x07);
+ data = &ra_buf[0];
+ data_len = 2;
+ } else {
+ ra_buf[0] = (uint8_t)(rach->ra);
+ data = &ra_buf[0];
+ data_len = 1;
+ }
+ break;
+ }
+ /* fall through */
+ default:
+ LOGPFSML(trxcon->fi, LOGL_ERROR,
+ "Unhandled L2 DATA.cnf (type 0x%02x)\n", dt);
+ return -ENODEV;
+ }
+
+ if (trxcon->gsmtap != NULL) {
+ trxcon_gsmtap_send(trxcon->gsmtap, lchan_desc->gsmtap_chan_type,
+ fn, lchan->ts->index, lchan_desc->ss_nr,
+ trxcon->l1p.band_arfcn | ARFCN_UPLINK,
+ 0, 0, data, data_len);
+ }
+
+ return rc;
+}
+
+/* External L1 API for the PHYIF */
+int osmo_trxcon_phyif_handle_bi(void *priv, const struct osmo_trxcon_phyif_bi *bi)
+{
+ struct osmo_trxcon_inst *trxcon = priv;
+ const struct l1sched_meas_set meas = {
+ .fn = bi->fn,
+ .toa256 = bi->toa256,
+ .rssi = bi->rssi,
+ };
+
+ /* Poke scheduler */
+ l1sched_handle_rx_burst(trxcon->sched, bi->tn, bi->fn,
+ bi->burst, bi->burst_len, &meas);
+
+ /* Correct local clock counter */
+ if (bi->fn % 51 == 0)
+ l1sched_clck_handle(trxcon->sched, bi->fn);
+
+ return 0;
+}
+
+int osmo_trxcon_phyif_handle_rsp(void *priv, const struct osmo_trxcon_phyif_rsp *rsp)
+{
+ struct osmo_trxcon_inst *trxcon = priv;
+
+ switch (rsp->type) {
+ case OSMO_TRXCON_PHYIF_CMDT_MEASURE:
+ {
+ const struct osmo_trxcon_phyif_rspp_measure *meas = &rsp->param.measure;
+ struct trxcon_param_full_power_scan_res res = {
+ .band_arfcn = meas->band_arfcn,
+ .dbm = meas->dbm,
+ };
+
+ return osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_FULL_POWER_SCAN_RES, &res);
+ }
+ default:
+ LOGPFSML(trxcon->fi, LOGL_ERROR,
+ "Unhandled PHYIF response (type 0x%02x)\n", rsp->type);
+ return -ENODEV;
+ }
+}
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/30103
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I56701b471a6f1c30ffd107037c2b1aed65621b2c
Gerrit-Change-Number: 30103
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange
1
0
12 Nov '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/30104 )
Change subject: trxcon: drop unneeded imports in trxcon_main.c
......................................................................
trxcon: drop unneeded imports in trxcon_main.c
Change-Id: I2868f83f55a6cbf3efc59f35ab7666671d22cf93
---
M src/host/trxcon/src/trxcon_main.c
1 file changed, 0 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/04/30104/1
diff --git a/src/host/trxcon/src/trxcon_main.c b/src/host/trxcon/src/trxcon_main.c
index 440bc0f..e42d6d7 100644
--- a/src/host/trxcon/src/trxcon_main.c
+++ b/src/host/trxcon/src/trxcon_main.c
@@ -28,8 +28,6 @@
#include <errno.h>
#include <time.h>
-#include <arpa/inet.h>
-
#include <osmocom/core/fsm.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
@@ -39,8 +37,6 @@
#include <osmocom/core/gsmtap_util.h>
#include <osmocom/core/gsmtap.h>
-#include <osmocom/gsm/gsm_utils.h>
-
#include <osmocom/bb/trxcon/trxcon.h>
#include <osmocom/bb/trxcon/trxcon_fsm.h>
#include <osmocom/bb/trxcon/phyif.h>
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/30104
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I2868f83f55a6cbf3efc59f35ab7666671d22cf93
Gerrit-Change-Number: 30104
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange
1
0
Change in osmocom-bb[master]: trxcon: reorganize the core logic into libtrxcon.la
by fixeria 12 Nov '22
by fixeria 12 Nov '22
12 Nov '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/30101 )
Change subject: trxcon: reorganize the core logic into libtrxcon.la
......................................................................
trxcon: reorganize the core logic into libtrxcon.la
This is needed for the integration with osmo-trx-ms. It was decided
to run the scheduler within the transceiver process, so that we can
reduce scheduling latency. The idea is to link osmo-trx-ms against
the libtrxcon, which will evolve into the libosmo-trxcon.so soon.
We cannot use hard-coded logging categoris in a library, so add new
API for setting them: trxcon_set_log_cfg(). Use DLGLOBAL by default.
Change-Id: Idf207947f620a7394e0a0e5bf2c37bcd8df64bbe
Related: OS#5599
---
M src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
M src/host/trxcon/src/Makefile.am
M src/host/trxcon/src/l1ctl.c
M src/host/trxcon/src/logging.c
M src/host/trxcon/src/trxcon_fsm.c
M src/host/trxcon/src/trxcon_inst.c
M src/host/trxcon/src/trxcon_main.c
7 files changed, 91 insertions(+), 44 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/01/30101/1
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
index e5ba5ec..9dae606 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
@@ -31,6 +31,16 @@
} l1p;
};
+struct trxcon_log_cfg {
+ int fsm; /* trxcon_fsm */
+ int l1c; /* L1CTL control */
+ int l1d; /* L1CTL data */
+ int schc; /* l1sched control */
+ int schd; /* l1sched data */
+};
+
+void trxcon_set_log_cfg(const struct trxcon_log_cfg *cfg);
+
struct trxcon_inst *trxcon_inst_alloc(void *ctx, unsigned int id, uint32_t fn_advance);
void trxcon_inst_free(struct trxcon_inst *trxcon);
diff --git a/src/host/trxcon/src/Makefile.am b/src/host/trxcon/src/Makefile.am
index e0dc337..e0ce6a2 100644
--- a/src/host/trxcon/src/Makefile.am
+++ b/src/host/trxcon/src/Makefile.am
@@ -35,20 +35,30 @@
$(NULL)
+noinst_LTLIBRARIES += libtrxcon.la
+
+libtrxcon_la_SOURCES = \
+ trxcon_inst.c \
+ trxcon_fsm.c \
+ l1ctl.c \
+ $(NULL)
+
+libtrxcon_la_LIBADD = \
+ libl1sched.la \
+ $(LIBOSMOCORE_LIBS) \
+ $(LIBOSMOGSM_LIBS) \
+ $(NULL)
+
+
bin_PROGRAMS = trxcon
trxcon_SOURCES = \
l1ctl_server.c \
- l1ctl.c \
- trx_if.c \
- logging.c \
- trxcon_fsm.c \
- trxcon_inst.c \
trxcon_main.c \
+ logging.c \
+ trx_if.c \
$(NULL)
trxcon_LDADD = \
- libl1sched.la \
- $(LIBOSMOCORE_LIBS) \
- $(LIBOSMOGSM_LIBS) \
+ libtrxcon.la \
$(NULL)
diff --git a/src/host/trxcon/src/l1ctl.c b/src/host/trxcon/src/l1ctl.c
index 17c136a..47998d6 100644
--- a/src/host/trxcon/src/l1ctl.c
+++ b/src/host/trxcon/src/l1ctl.c
@@ -32,6 +32,7 @@
#include <osmocom/core/fsm.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/core/logging.h>
#include <osmocom/gsm/gsm0502.h>
#include <osmocom/gsm/gsm_utils.h>
@@ -45,6 +46,10 @@
#define L1CTL_LENGTH 256
#define L1CTL_HEADROOM 32
+/* Logging categories configurable via trxcon_set_log_cfg() */
+int g_logc_l1c = DLGLOBAL;
+int g_logc_l1d = DLGLOBAL;
+
static const char *arfcn2band_name(uint16_t arfcn)
{
enum gsm_band band;
@@ -67,7 +72,7 @@
msg = msgb_alloc_headroom(L1CTL_LENGTH + L1CTL_HEADROOM,
L1CTL_HEADROOM, "l1ctl_tx_msg");
if (!msg) {
- LOGP(DL1C, LOGL_ERROR, "Failed to allocate memory\n");
+ LOGP(g_logc_l1c, LOGL_ERROR, "Failed to allocate memory\n");
return NULL;
}
@@ -88,7 +93,7 @@
if (!msg)
return -ENOMEM;
- LOGPFSMSL(fi, DL1C, LOGL_DEBUG,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_DEBUG,
"Send PM Conf (%s %d = %d dBm)\n",
arfcn2band_name(band_arfcn),
band_arfcn & ~ARFCN_FLAG_MASK, dbm);
@@ -116,7 +121,7 @@
if (!msg)
return -ENOMEM;
- LOGPFSMSL(fi, DL1C, LOGL_DEBUG, "Send Reset Ind (%u)\n", type);
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_DEBUG, "Send Reset Ind (%u)\n", type);
res = (struct l1ctl_reset *) msgb_put(msg, sizeof(*res));
res->type = type;
@@ -134,7 +139,7 @@
if (!msg)
return -ENOMEM;
- LOGPFSMSL(fi, DL1C, LOGL_DEBUG, "Send Reset Conf (%u)\n", type);
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_DEBUG, "Send Reset Conf (%u)\n", type);
res = (struct l1ctl_reset *) msgb_put(msg, sizeof(*res));
res->type = type;
@@ -183,7 +188,7 @@
fbsb_conf_make(msg, 255, 0);
- LOGPFSMSL(fi, DL1C, LOGL_DEBUG, "Send FBSB Conf (timeout)\n");
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_DEBUG, "Send FBSB Conf (timeout)\n");
return trxcon_l1ctl_send(trxcon, msg);
}
@@ -209,7 +214,7 @@
/* FIXME: set proper value */
conf->initial_freq_err = 0;
- LOGPFSMSL(fi, DL1C, LOGL_DEBUG,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_DEBUG,
"Send FBSB Conf (result=%u, bsic=%u)\n",
conf->result, conf->bsic);
@@ -323,7 +328,7 @@
return GSM_PCHAN_CCCH_SDCCH4_CBCH;
default:
- LOGP(DL1C, LOGL_NOTICE, "Undandled CCCH mode (%u), "
+ LOGP(g_logc_l1c, LOGL_NOTICE, "Undandled CCCH mode (%u), "
"assuming non-combined configuration\n", mode);
return GSM_PCHAN_CCCH;
}
@@ -337,7 +342,7 @@
fbsb = (struct l1ctl_fbsb_req *) msg->l1h;
if (msgb_l1len(msg) < sizeof(*fbsb)) {
- LOGPFSMSL(fi, DL1C, LOGL_ERROR,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_ERROR,
"MSG too short FBSB Req: %u\n",
msgb_l1len(msg));
rc = -EINVAL;
@@ -350,7 +355,7 @@
.band_arfcn = ntohs(fbsb->band_arfcn),
};
- LOGPFSMSL(fi, DL1C, LOGL_NOTICE,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_NOTICE,
"Received FBSB request (%s %d, timeout %u ms)\n",
arfcn2band_name(req.band_arfcn),
req.band_arfcn & ~ARFCN_FLAG_MASK,
@@ -371,7 +376,7 @@
pmr = (struct l1ctl_pm_req *) msg->l1h;
if (msgb_l1len(msg) < sizeof(*pmr)) {
- LOGPFSMSL(fi, DL1C, LOGL_ERROR,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_ERROR,
"MSG too short PM Req: %u\n",
msgb_l1len(msg));
rc = -EINVAL;
@@ -383,7 +388,7 @@
.band_arfcn_stop = ntohs(pmr->range.band_arfcn_to),
};
- LOGPFSMSL(fi, DL1C, LOGL_NOTICE,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_NOTICE,
"Received power measurement request (%s: %d -> %d)\n",
arfcn2band_name(req.band_arfcn_start),
req.band_arfcn_start & ~ARFCN_FLAG_MASK,
@@ -404,14 +409,14 @@
res = (struct l1ctl_reset *) msg->l1h;
if (msgb_l1len(msg) < sizeof(*res)) {
- LOGPFSMSL(fi, DL1C, LOGL_ERROR,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_ERROR,
"MSG too short Reset Req: %u\n",
msgb_l1len(msg));
rc = -EINVAL;
goto exit;
}
- LOGPFSMSL(fi, DL1C, LOGL_NOTICE,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_NOTICE,
"Received reset request (%u)\n", res->type);
switch (res->type) {
@@ -422,7 +427,7 @@
osmo_fsm_inst_dispatch(fi, TRXCON_EV_RESET_SCHED_REQ, NULL);
break;
default:
- LOGPFSMSL(fi, DL1C, LOGL_ERROR,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_ERROR,
"Unknown L1CTL_RESET_REQ type\n");
goto exit;
}
@@ -440,8 +445,8 @@
struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_hdr *l1h;
- LOGPFSMSL(fi, DL1C, LOGL_NOTICE, "Recv Echo Req\n");
- LOGPFSMSL(fi, DL1C, LOGL_NOTICE, "Send Echo Conf\n");
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_NOTICE, "Recv Echo Req\n");
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_NOTICE, "Send Echo Conf\n");
/* Nothing to do, just send it back */
l1h = (struct l1ctl_hdr *) msg->l1h;
@@ -459,14 +464,14 @@
mode_req = (struct l1ctl_ccch_mode_req *)msg->l1h;
if (msgb_l1len(msg) < sizeof(*mode_req)) {
- LOGPFSMSL(fi, DL1C, LOGL_ERROR,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_ERROR,
"MSG too short Reset Req: %u\n",
msgb_l1len(msg));
rc = -EINVAL;
goto exit;
}
- LOGPFSMSL(fi, DL1C, LOGL_NOTICE, "Received CCCH mode request (%u)\n",
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_NOTICE, "Received CCCH mode request (%u)\n",
mode_req->ccch_mode); /* TODO: add value-string for ccch_mode */
struct trxcon_param_set_ccch_tch_mode_req req = {
@@ -501,7 +506,7 @@
.is_11bit = true,
};
- LOGPFSMSL(fi, DL1C, LOGL_NOTICE,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_NOTICE,
"Received 11-bit RACH request "
"(offset=%u, synch_seq=%u, ra11=0x%02hx)\n",
req.offset, req.synch_seq, req.ra);
@@ -513,7 +518,7 @@
.ra = rr->ra,
};
- LOGPFSMSL(fi, DL1C, LOGL_NOTICE,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_NOTICE,
"Received 8-bit RACH request "
"(offset=%u, ra=0x%02x)\n", req.offset, req.ra);
}
@@ -521,7 +526,7 @@
/* The controlling L1CTL side always does include the UL info header,
* but may leave it empty. We assume RACH is on TS0 in this case. */
if (ul->chan_nr == 0x00) {
- LOGPFSMSL(fi, DL1C, LOGL_NOTICE,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_NOTICE,
"The UL info header is empty, assuming RACH is on TS0\n");
req.chan_nr = RSL_CHAN_RACH;
req.link_id = 0x00;
@@ -542,7 +547,7 @@
{
req->h0.band_arfcn = ntohs(h->band_arfcn);
- LOGPFSMSL(fi, DL1C, LOGL_NOTICE,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_NOTICE,
"L1CTL_DM_EST_REQ indicates single ARFCN %s %u\n",
arfcn2band_name(req->h0.band_arfcn),
req->h0.band_arfcn & ~ARFCN_FLAG_MASK);
@@ -556,18 +561,18 @@
{
unsigned int i;
- LOGPFSMSL(fi, DL1C, LOGL_NOTICE,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_NOTICE,
"L1CTL_DM_EST_REQ indicates a Frequency "
"Hopping (hsn=%u, maio=%u, chans=%u) channel\n",
h->hsn, h->maio, h->n);
/* No channels?!? */
if (!h->n) {
- LOGPFSMSL(fi, DL1C, LOGL_ERROR,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_ERROR,
"No channels in mobile allocation?!?\n");
return -EINVAL;
} else if (h->n > ARRAY_SIZE(h->ma)) {
- LOGPFSMSL(fi, DL1C, LOGL_ERROR,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_ERROR,
"More than 64 channels in mobile allocation?!?\n");
return -EINVAL;
}
@@ -599,7 +604,7 @@
.hopping = est_req->h,
};
- LOGPFSMSL(fi, DL1C, LOGL_NOTICE,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_NOTICE,
"Received L1CTL_DM_EST_REQ "
"(tn=%u, chan_nr=0x%02x, tsc=%u, tch_mode=0x%02x)\n",
req.chan_nr & 0x07, req.chan_nr, req.tsc, req.tch_mode);
@@ -623,7 +628,7 @@
{
struct osmo_fsm_inst *fi = trxcon->fi;
- LOGPFSMSL(fi, DL1C, LOGL_NOTICE, "Received L1CTL_DM_REL_REQ\n");
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_NOTICE, "Received L1CTL_DM_REL_REQ\n");
osmo_fsm_inst_dispatch(fi, TRXCON_EV_DEDICATED_RELEASE_REQ, NULL);
@@ -651,7 +656,7 @@
.data = ul->payload,
};
- LOGPFSMSL(fi, DL1D, LOGL_DEBUG,
+ LOGPFSMSL(fi, g_logc_l1d, LOGL_DEBUG,
"Recv %s Req (chan_nr=0x%02x, link_id=0x%02x, len=%zu)\n",
traffic ? "TRAFFIC" : "DATA", req.chan_nr, req.link_id, req.data_len);
@@ -678,7 +683,7 @@
ul = (struct l1ctl_info_ul *) msg->l1h;
par_req = (struct l1ctl_par_req *) ul->payload;
- LOGPFSMSL(fi, DL1C, LOGL_NOTICE,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_NOTICE,
"Received L1CTL_PARAM_REQ (ta=%d, tx_power=%u)\n",
par_req->ta, par_req->tx_power);
@@ -704,7 +709,7 @@
mode_req = (struct l1ctl_tch_mode_req *)msg->l1h;
- LOGPFSMSL(fi, DL1C, LOGL_NOTICE,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_NOTICE,
"Received L1CTL_TCH_MODE_REQ (tch_mode=%u, audio_mode=%u)\n",
mode_req->tch_mode, mode_req->audio_mode);
@@ -747,7 +752,7 @@
.key = cr->key,
};
- LOGPFSMSL(fi, DL1C, LOGL_NOTICE,
+ LOGPFSMSL(fi, g_logc_l1c, LOGL_NOTICE,
"L1CTL_CRYPTO_REQ (algo=A5/%u, key_len=%u)\n",
req.a5_algo, req.key_len);
@@ -800,13 +805,13 @@
case L1CTL_TBF_CFG_REQ:
case L1CTL_DM_FREQ_REQ:
case L1CTL_SIM_REQ:
- LOGPFSMSL(trxcon->fi, DL1C, LOGL_NOTICE,
+ LOGPFSMSL(trxcon->fi, g_logc_l1c, LOGL_NOTICE,
"Ignoring unsupported message (type=%u)\n",
l1h->msg_type);
msgb_free(msg);
return -ENOTSUP;
default:
- LOGPFSMSL(trxcon->fi, DL1C, LOGL_ERROR, "Unknown MSG type %u: %s\n",
+ LOGPFSMSL(trxcon->fi, g_logc_l1c, LOGL_ERROR, "Unknown MSG type %u: %s\n",
l1h->msg_type, osmo_hexdump(msgb_data(msg), msgb_length(msg)));
msgb_free(msg);
return -EINVAL;
diff --git a/src/host/trxcon/src/logging.c b/src/host/trxcon/src/logging.c
index 747b1ad..f5fdacc 100644
--- a/src/host/trxcon/src/logging.c
+++ b/src/host/trxcon/src/logging.c
@@ -21,6 +21,7 @@
#include <osmocom/core/logging.h>
#include <osmocom/core/utils.h>
+#include <osmocom/bb/trxcon/trxcon.h>
#include <osmocom/bb/trxcon/logging.h>
static struct log_info_cat trxcon_log_info_cat[] = {
@@ -80,5 +81,15 @@
if (category_mask)
log_parse_category_mask(osmo_stderr_target, category_mask);
+ const struct trxcon_log_cfg cfg = {
+ .fsm = DAPP,
+ .l1c = DL1C,
+ .l1d = DL1D,
+ .schc = DSCH,
+ .schd = DSCHD,
+ };
+
+ trxcon_set_log_cfg(&cfg);
+
return 0;
}
diff --git a/src/host/trxcon/src/trxcon_fsm.c b/src/host/trxcon/src/trxcon_fsm.c
index 28a4ecb..9980344 100644
--- a/src/host/trxcon/src/trxcon_fsm.c
+++ b/src/host/trxcon/src/trxcon_fsm.c
@@ -26,11 +26,11 @@
#include <osmocom/core/fsm.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/core/logging.h>
#include <osmocom/bb/trxcon/trxcon.h>
#include <osmocom/bb/trxcon/trxcon_fsm.h>
#include <osmocom/bb/trxcon/phyif.h>
-#include <osmocom/bb/trxcon/logging.h>
#include <osmocom/bb/trxcon/l1ctl.h>
#include <osmocom/bb/l1sched/l1sched.h>
#include <osmocom/bb/l1sched/logging.h>
@@ -649,7 +649,7 @@
.name = "trxcon",
.states = trxcon_fsm_states,
.num_states = ARRAY_SIZE(trxcon_fsm_states),
- .log_subsys = DAPP,
+ .log_subsys = DLGLOBAL,
.event_names = trxcon_fsm_event_names,
.allstate_event_mask = S(TRXCON_EV_PHYIF_FAILURE)
| S(TRXCON_EV_L2IF_FAILURE)
diff --git a/src/host/trxcon/src/trxcon_inst.c b/src/host/trxcon/src/trxcon_inst.c
index c3a85da..5d96021 100644
--- a/src/host/trxcon/src/trxcon_inst.c
+++ b/src/host/trxcon/src/trxcon_inst.c
@@ -26,6 +26,18 @@
#include <osmocom/bb/trxcon/trxcon.h>
#include <osmocom/bb/trxcon/trxcon_fsm.h>
#include <osmocom/bb/l1sched/l1sched.h>
+#include <osmocom/bb/l1sched/logging.h>
+
+extern int g_logc_l1c;
+extern int g_logc_l1d;
+
+void trxcon_set_log_cfg(const struct trxcon_log_cfg *cfg)
+{
+ l1sched_logging_init(cfg->schc, cfg->schd);
+ trxcon_fsm_def.log_subsys = cfg->fsm;
+ g_logc_l1c = cfg->l1c;
+ g_logc_l1d = cfg->l1d;
+}
struct trxcon_inst *trxcon_inst_alloc(void *ctx, unsigned int id, uint32_t fn_advance)
{
diff --git a/src/host/trxcon/src/trxcon_main.c b/src/host/trxcon/src/trxcon_main.c
index 1ed2f89..94deeab 100644
--- a/src/host/trxcon/src/trxcon_main.c
+++ b/src/host/trxcon/src/trxcon_main.c
@@ -543,7 +543,6 @@
/* Init logging system */
trxcon_logging_init(tall_trxcon_ctx, app_data.debug_mask);
- l1sched_logging_init(DSCH, DSCHD);
/* Configure pretty logging */
log_set_print_extended_timestamp(osmo_stderr_target, 1);
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/30101
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Idf207947f620a7394e0a0e5bf2c37bcd8df64bbe
Gerrit-Change-Number: 30101
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange
1
0
Change in osmocom-bb[master]: trxcon: use 'osmo_trxcon_' prefix for public libtrxcon API
by fixeria 12 Nov '22
by fixeria 12 Nov '22
12 Nov '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/30102 )
Change subject: trxcon: use 'osmo_trxcon_' prefix for public libtrxcon API
......................................................................
trxcon: use 'osmo_trxcon_' prefix for public libtrxcon API
Also take a chance to shorten some symbols with long names:
* struct phyif_burst_req -> osmo_trxcon_phyif_br,
* struct phyif_burst_ind -> osmo_trxcon_phyif_bi,
* phyif_handle_burst_ind() -> osmo_trxcon_phyif_handle_bi(),
* phyif_handle_burst_req() -> osmo_trxcon_phyif_handle_br(),
* trx_if_handle_phyif_burst_req() -> trx_if_handle_phyif_br().
Change-Id: I0c5b8642c9c436e8beab0dc80fb7fd96cda25547
Related: OS#5599
---
M src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
M src/host/trxcon/include/osmocom/bb/trxcon/phyif.h
M src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h
M src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
M src/host/trxcon/src/l1ctl.c
M src/host/trxcon/src/logging.c
M src/host/trxcon/src/trx_if.c
M src/host/trxcon/src/trxcon_fsm.c
M src/host/trxcon/src/trxcon_inst.c
M src/host/trxcon/src/trxcon_main.c
10 files changed, 185 insertions(+), 182 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/02/30102/1
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
index 949960c..771d703 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
@@ -7,16 +7,16 @@
struct trxcon_param_tx_data_cnf;
struct trxcon_param_tx_access_burst_cnf;
-int l1ctl_tx_fbsb_conf(struct trxcon_inst *trxcon, uint16_t band_arfcn, uint8_t bsic);
-int l1ctl_tx_fbsb_fail(struct trxcon_inst *trxcon, uint16_t band_arfcn);
-int l1ctl_tx_ccch_mode_conf(struct trxcon_inst *trxcon, uint8_t mode);
-int l1ctl_tx_pm_conf(struct trxcon_inst *trxcon, uint16_t band_arfcn, int dbm, int last);
-int l1ctl_tx_reset_conf(struct trxcon_inst *trxcon, uint8_t type);
-int l1ctl_tx_reset_ind(struct trxcon_inst *trxcon, uint8_t type);
+int l1ctl_tx_fbsb_conf(struct osmo_trxcon_inst *trxcon, uint16_t band_arfcn, uint8_t bsic);
+int l1ctl_tx_fbsb_fail(struct osmo_trxcon_inst *trxcon, uint16_t band_arfcn);
+int l1ctl_tx_ccch_mode_conf(struct osmo_trxcon_inst *trxcon, uint8_t mode);
+int l1ctl_tx_pm_conf(struct osmo_trxcon_inst *trxcon, uint16_t band_arfcn, int dbm, int last);
+int l1ctl_tx_reset_conf(struct osmo_trxcon_inst *trxcon, uint8_t type);
+int l1ctl_tx_reset_ind(struct osmo_trxcon_inst *trxcon, uint8_t type);
-int l1ctl_tx_dt_ind(struct trxcon_inst *trxcon,
+int l1ctl_tx_dt_ind(struct osmo_trxcon_inst *trxcon,
const struct trxcon_param_rx_data_ind *ind);
-int l1ctl_tx_dt_conf(struct trxcon_inst *trxcon,
+int l1ctl_tx_dt_conf(struct osmo_trxcon_inst *trxcon,
const struct trxcon_param_tx_data_cnf *cnf);
-int l1ctl_tx_rach_conf(struct trxcon_inst *trxcon,
+int l1ctl_tx_rach_conf(struct osmo_trxcon_inst *trxcon,
const struct trxcon_param_tx_access_burst_cnf *cnf);
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h b/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h
index a92cb89..de6c3fd 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/phyif.h
@@ -5,72 +5,72 @@
#include <osmocom/core/bits.h>
/* PHYIF command type */
-enum phyif_cmd_type {
- PHYIF_CMDT_RESET,
- PHYIF_CMDT_POWERON,
- PHYIF_CMDT_POWEROFF,
- PHYIF_CMDT_MEASURE,
- PHYIF_CMDT_SETFREQ_H0,
- PHYIF_CMDT_SETFREQ_H1,
- PHYIF_CMDT_SETSLOT,
- PHYIF_CMDT_SETTA,
+enum osmo_trxcon_phyif_cmd_type {
+ OSMO_TRXCON_PHYIF_CMDT_RESET,
+ OSMO_TRXCON_PHYIF_CMDT_POWERON,
+ OSMO_TRXCON_PHYIF_CMDT_POWEROFF,
+ OSMO_TRXCON_PHYIF_CMDT_MEASURE,
+ OSMO_TRXCON_PHYIF_CMDT_SETFREQ_H0,
+ OSMO_TRXCON_PHYIF_CMDT_SETFREQ_H1,
+ OSMO_TRXCON_PHYIF_CMDT_SETSLOT,
+ OSMO_TRXCON_PHYIF_CMDT_SETTA,
};
-/* param of PHYIF_CMDT_SETFREQ_H0 */
-struct phyif_cmdp_setfreq_h0 {
+/* param of OSMO_TRXCON_PHYIF_CMDT_SETFREQ_H0 */
+struct osmo_trxcon_phyif_cmdp_setfreq_h0 {
uint16_t band_arfcn;
};
-/* param of PHYIF_CMDT_SETFREQ_H1 */
-struct phyif_cmdp_setfreq_h1 {
+/* param of OSMO_TRXCON_PHYIF_CMDT_SETFREQ_H1 */
+struct osmo_trxcon_phyif_cmdp_setfreq_h1 {
uint8_t hsn;
uint8_t maio;
const uint16_t *ma;
unsigned int ma_len;
};
-/* param of PHYIF_CMDT_SETSLOT */
-struct phyif_cmdp_setslot {
+/* param of OSMO_TRXCON_PHYIF_CMDT_SETSLOT */
+struct osmo_trxcon_phyif_cmdp_setslot {
uint8_t tn;
uint8_t pchan; /* enum gsm_phys_chan_config */
};
-/* param of PHYIF_CMDT_SETTA */
-struct phyif_cmdp_setta {
+/* param of OSMO_TRXCON_PHYIF_CMDT_SETTA */
+struct osmo_trxcon_phyif_cmdp_setta {
int8_t ta; /* intentionally signed */
};
-/* param of PHYIF_CMDT_MEASURE (command) */
-struct phyif_cmdp_measure {
+/* param of OSMO_TRXCON_PHYIF_CMDT_MEASURE (command) */
+struct osmo_trxcon_phyif_cmdp_measure {
uint16_t band_arfcn;
};
-/* param of PHYIF_CMDT_MEASURE (response) */
-struct phyif_rspp_measure {
+/* param of OSMO_TRXCON_PHYIF_CMDT_MEASURE (response) */
+struct osmo_trxcon_phyif_rspp_measure {
uint16_t band_arfcn;
int dbm;
};
-struct phyif_cmd {
- enum phyif_cmd_type type;
+struct osmo_trxcon_phyif_cmd {
+ enum osmo_trxcon_phyif_cmd_type type;
union {
- struct phyif_cmdp_setfreq_h0 setfreq_h0;
- struct phyif_cmdp_setfreq_h1 setfreq_h1;
- struct phyif_cmdp_setslot setslot;
- struct phyif_cmdp_setta setta;
- struct phyif_cmdp_measure measure;
+ struct osmo_trxcon_phyif_cmdp_setfreq_h0 setfreq_h0;
+ struct osmo_trxcon_phyif_cmdp_setfreq_h1 setfreq_h1;
+ struct osmo_trxcon_phyif_cmdp_setslot setslot;
+ struct osmo_trxcon_phyif_cmdp_setta setta;
+ struct osmo_trxcon_phyif_cmdp_measure measure;
} param;
};
-struct phyif_rsp {
- enum phyif_cmd_type type;
+struct osmo_trxcon_phyif_rsp {
+ enum osmo_trxcon_phyif_cmd_type type;
union {
- struct phyif_rspp_measure measure;
+ struct osmo_trxcon_phyif_rspp_measure measure;
} param;
};
/* BURST.req - a burst to be transmitted */
-struct phyif_burst_req {
+struct osmo_trxcon_phyif_br {
uint32_t fn;
uint8_t tn;
uint8_t pwr;
@@ -79,7 +79,7 @@
};
/* BURST.ind - a received burst */
-struct phyif_burst_ind {
+struct osmo_trxcon_phyif_bi {
uint32_t fn;
uint8_t tn;
int16_t toa256;
@@ -89,8 +89,8 @@
};
-int phyif_handle_burst_ind(void *phyif, const struct phyif_burst_ind *bi);
-int phyif_handle_burst_req(void *phyif, const struct phyif_burst_req *br);
-int phyif_handle_cmd(void *phyif, const struct phyif_cmd *cmd);
-int phyif_handle_rsp(void *phyif, const struct phyif_rsp *rsp);
-void phyif_close(void *phyif);
+int osmo_trxcon_phyif_handle_bi(void *phyif, const struct osmo_trxcon_phyif_bi *bi);
+int osmo_trxcon_phyif_handle_br(void *phyif, const struct osmo_trxcon_phyif_br *br);
+int osmo_trxcon_phyif_handle_cmd(void *phyif, const struct osmo_trxcon_phyif_cmd *cmd);
+int osmo_trxcon_phyif_handle_rsp(void *phyif, const struct osmo_trxcon_phyif_rsp *rsp);
+void osmo_trxcon_phyif_close(void *phyif);
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h b/src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h
index 92de3b0..f6b7893 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/trx_if.h
@@ -55,5 +55,7 @@
struct trx_instance *trx_if_open(const struct trx_if_params *params);
void trx_if_close(struct trx_instance *trx);
-int trx_if_handle_phyif_burst_req(struct trx_instance *trx, const struct phyif_burst_req *br);
-int trx_if_handle_phyif_cmd(struct trx_instance *trx, const struct phyif_cmd *cmd);
+int trx_if_handle_phyif_br(struct trx_instance *trx,
+ const struct osmo_trxcon_phyif_br *br);
+int trx_if_handle_phyif_cmd(struct trx_instance *trx,
+ const struct osmo_trxcon_phyif_cmd *cmd);
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
index 9dae606..b3966bf 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
@@ -6,7 +6,7 @@
struct l1sched_state;
struct msgb;
-struct trxcon_inst {
+struct osmo_trxcon_inst {
struct osmo_fsm_inst *fi;
unsigned int id;
@@ -31,7 +31,7 @@
} l1p;
};
-struct trxcon_log_cfg {
+struct osmo_trxcon_log_cfg {
int fsm; /* trxcon_fsm */
int l1c; /* L1CTL control */
int l1d; /* L1CTL data */
@@ -39,11 +39,11 @@
int schd; /* l1sched data */
};
-void trxcon_set_log_cfg(const struct trxcon_log_cfg *cfg);
+void osmo_trxcon_set_log_cfg(const struct osmo_trxcon_log_cfg *cfg);
-struct trxcon_inst *trxcon_inst_alloc(void *ctx, unsigned int id, uint32_t fn_advance);
-void trxcon_inst_free(struct trxcon_inst *trxcon);
+struct osmo_trxcon_inst *osmo_trxcon_inst_alloc(void *ctx, unsigned int id, uint32_t fn_advance);
+void osmo_trxcon_inst_free(struct osmo_trxcon_inst *trxcon);
-int trxcon_l1ctl_receive(struct trxcon_inst *trxcon, struct msgb *msg);
-int trxcon_l1ctl_send(struct trxcon_inst *trxcon, struct msgb *msg);
-void trxcon_l1ctl_close(struct trxcon_inst *trxcon);
+int osmo_trxcon_l1ctl_receive(struct osmo_trxcon_inst *trxcon, struct msgb *msg);
+int osmo_trxcon_l1ctl_send(struct osmo_trxcon_inst *trxcon, struct msgb *msg);
+void osmo_trxcon_l1ctl_close(struct osmo_trxcon_inst *trxcon);
diff --git a/src/host/trxcon/src/l1ctl.c b/src/host/trxcon/src/l1ctl.c
index 47998d6..6462ce2 100644
--- a/src/host/trxcon/src/l1ctl.c
+++ b/src/host/trxcon/src/l1ctl.c
@@ -46,7 +46,7 @@
#define L1CTL_LENGTH 256
#define L1CTL_HEADROOM 32
-/* Logging categories configurable via trxcon_set_log_cfg() */
+/* Logging categories configurable via osmo_trxcon_set_log_cfg() */
int g_logc_l1c = DLGLOBAL;
int g_logc_l1d = DLGLOBAL;
@@ -83,7 +83,7 @@
return msg;
}
-int l1ctl_tx_pm_conf(struct trxcon_inst *trxcon, uint16_t band_arfcn, int dbm, int last)
+int l1ctl_tx_pm_conf(struct osmo_trxcon_inst *trxcon, uint16_t band_arfcn, int dbm, int last)
{
struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_pm_conf *pmc;
@@ -108,10 +108,10 @@
l1h->flags |= L1CTL_F_DONE;
}
- return trxcon_l1ctl_send(trxcon, msg);
+ return osmo_trxcon_l1ctl_send(trxcon, msg);
}
-int l1ctl_tx_reset_ind(struct trxcon_inst *trxcon, uint8_t type)
+int l1ctl_tx_reset_ind(struct osmo_trxcon_inst *trxcon, uint8_t type)
{
struct osmo_fsm_inst *fi = trxcon->fi;
struct msgb *msg;
@@ -126,10 +126,10 @@
res = (struct l1ctl_reset *) msgb_put(msg, sizeof(*res));
res->type = type;
- return trxcon_l1ctl_send(trxcon, msg);
+ return osmo_trxcon_l1ctl_send(trxcon, msg);
}
-int l1ctl_tx_reset_conf(struct trxcon_inst *trxcon, uint8_t type)
+int l1ctl_tx_reset_conf(struct osmo_trxcon_inst *trxcon, uint8_t type)
{
struct osmo_fsm_inst *fi = trxcon->fi;
struct msgb *msg;
@@ -143,7 +143,7 @@
res = (struct l1ctl_reset *) msgb_put(msg, sizeof(*res));
res->type = type;
- return trxcon_l1ctl_send(trxcon, msg);
+ return osmo_trxcon_l1ctl_send(trxcon, msg);
}
static struct l1ctl_info_dl *put_dl_info_hdr(struct msgb *msg,
@@ -171,7 +171,7 @@
return conf;
}
-int l1ctl_tx_fbsb_fail(struct trxcon_inst *trxcon, uint16_t band_arfcn)
+int l1ctl_tx_fbsb_fail(struct osmo_trxcon_inst *trxcon, uint16_t band_arfcn)
{
struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_info_dl *dl;
@@ -190,10 +190,10 @@
LOGPFSMSL(fi, g_logc_l1c, LOGL_DEBUG, "Send FBSB Conf (timeout)\n");
- return trxcon_l1ctl_send(trxcon, msg);
+ return osmo_trxcon_l1ctl_send(trxcon, msg);
}
-int l1ctl_tx_fbsb_conf(struct trxcon_inst *trxcon, uint16_t band_arfcn, uint8_t bsic)
+int l1ctl_tx_fbsb_conf(struct osmo_trxcon_inst *trxcon, uint16_t band_arfcn, uint8_t bsic)
{
struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_fbsb_conf *conf;
@@ -218,10 +218,10 @@
"Send FBSB Conf (result=%u, bsic=%u)\n",
conf->result, conf->bsic);
- return trxcon_l1ctl_send(trxcon, msg);
+ return osmo_trxcon_l1ctl_send(trxcon, msg);
}
-int l1ctl_tx_ccch_mode_conf(struct trxcon_inst *trxcon, uint8_t mode)
+int l1ctl_tx_ccch_mode_conf(struct osmo_trxcon_inst *trxcon, uint8_t mode)
{
struct l1ctl_ccch_mode_conf *conf;
struct msgb *msg;
@@ -233,13 +233,13 @@
conf = (struct l1ctl_ccch_mode_conf *) msgb_put(msg, sizeof(*conf));
conf->ccch_mode = mode;
- return trxcon_l1ctl_send(trxcon, msg);
+ return osmo_trxcon_l1ctl_send(trxcon, msg);
}
/**
* Handles both L1CTL_DATA_IND and L1CTL_TRAFFIC_IND.
*/
-int l1ctl_tx_dt_ind(struct trxcon_inst *trxcon,
+int l1ctl_tx_dt_ind(struct osmo_trxcon_inst *trxcon,
const struct trxcon_param_rx_data_ind *ind)
{
struct msgb *msg;
@@ -266,10 +266,10 @@
memcpy(msgb_put(msg, ind->data_len), ind->data, ind->data_len);
/* Put message to upper layers */
- return trxcon_l1ctl_send(trxcon, msg);
+ return osmo_trxcon_l1ctl_send(trxcon, msg);
}
-int l1ctl_tx_rach_conf(struct trxcon_inst *trxcon,
+int l1ctl_tx_rach_conf(struct osmo_trxcon_inst *trxcon,
const struct trxcon_param_tx_access_burst_cnf *cnf)
{
struct msgb *msg;
@@ -285,14 +285,14 @@
put_dl_info_hdr(msg, &dl_hdr);
- return trxcon_l1ctl_send(trxcon, msg);
+ return osmo_trxcon_l1ctl_send(trxcon, msg);
}
/**
* Handles both L1CTL_DATA_CONF and L1CTL_TRAFFIC_CONF.
*/
-int l1ctl_tx_dt_conf(struct trxcon_inst *trxcon,
+int l1ctl_tx_dt_conf(struct osmo_trxcon_inst *trxcon,
struct trxcon_param_tx_data_cnf *cnf)
{
struct msgb *msg;
@@ -311,7 +311,7 @@
/* Copy DL frame header from source message */
put_dl_info_hdr(msg, &dl_hdr);
- return trxcon_l1ctl_send(trxcon, msg);
+ return osmo_trxcon_l1ctl_send(trxcon, msg);
}
static enum gsm_phys_chan_config l1ctl_ccch_mode2pchan_config(enum ccch_mode mode)
@@ -334,7 +334,7 @@
}
}
-static int l1ctl_rx_fbsb_req(struct trxcon_inst *trxcon, struct msgb *msg)
+static int l1ctl_rx_fbsb_req(struct osmo_trxcon_inst *trxcon, struct msgb *msg)
{
struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_fbsb_req *fbsb;
@@ -368,7 +368,7 @@
return rc;
}
-static int l1ctl_rx_pm_req(struct trxcon_inst *trxcon, struct msgb *msg)
+static int l1ctl_rx_pm_req(struct osmo_trxcon_inst *trxcon, struct msgb *msg)
{
struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_pm_req *pmr;
@@ -401,7 +401,7 @@
return rc;
}
-static int l1ctl_rx_reset_req(struct trxcon_inst *trxcon, struct msgb *msg)
+static int l1ctl_rx_reset_req(struct osmo_trxcon_inst *trxcon, struct msgb *msg)
{
struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_reset *res;
@@ -440,7 +440,7 @@
return rc;
}
-static int l1ctl_rx_echo_req(struct trxcon_inst *trxcon, struct msgb *msg)
+static int l1ctl_rx_echo_req(struct osmo_trxcon_inst *trxcon, struct msgb *msg)
{
struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_hdr *l1h;
@@ -453,10 +453,10 @@
l1h->msg_type = L1CTL_ECHO_CONF;
msg->data = msg->l1h;
- return trxcon_l1ctl_send(trxcon, msg);
+ return osmo_trxcon_l1ctl_send(trxcon, msg);
}
-static int l1ctl_rx_ccch_mode_req(struct trxcon_inst *trxcon, struct msgb *msg)
+static int l1ctl_rx_ccch_mode_req(struct osmo_trxcon_inst *trxcon, struct msgb *msg)
{
struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_ccch_mode_req *mode_req;
@@ -488,7 +488,7 @@
return rc;
}
-static int l1ctl_rx_rach_req(struct trxcon_inst *trxcon, struct msgb *msg, bool is_11bit)
+static int l1ctl_rx_rach_req(struct osmo_trxcon_inst *trxcon, struct msgb *msg, bool is_11bit)
{
struct trxcon_param_tx_access_burst_req req;
struct osmo_fsm_inst *fi = trxcon->fi;
@@ -587,7 +587,7 @@
return 0;
}
-static int l1ctl_rx_dm_est_req(struct trxcon_inst *trxcon, struct msgb *msg)
+static int l1ctl_rx_dm_est_req(struct osmo_trxcon_inst *trxcon, struct msgb *msg)
{
struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_dm_est_req *est_req;
@@ -624,7 +624,7 @@
return rc;
}
-static int l1ctl_rx_dm_rel_req(struct trxcon_inst *trxcon, struct msgb *msg)
+static int l1ctl_rx_dm_rel_req(struct osmo_trxcon_inst *trxcon, struct msgb *msg)
{
struct osmo_fsm_inst *fi = trxcon->fi;
@@ -639,7 +639,7 @@
/**
* Handles both L1CTL_DATA_REQ and L1CTL_TRAFFIC_REQ.
*/
-static int l1ctl_rx_dt_req(struct trxcon_inst *trxcon, struct msgb *msg, bool traffic)
+static int l1ctl_rx_dt_req(struct osmo_trxcon_inst *trxcon, struct msgb *msg, bool traffic)
{
struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_info_ul *ul;
@@ -674,7 +674,7 @@
return 0;
}
-static int l1ctl_rx_param_req(struct trxcon_inst *trxcon, struct msgb *msg)
+static int l1ctl_rx_param_req(struct osmo_trxcon_inst *trxcon, struct msgb *msg)
{
struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_par_req *par_req;
@@ -701,7 +701,7 @@
return 0;
}
-static int l1ctl_rx_tch_mode_req(struct trxcon_inst *trxcon, struct msgb *msg)
+static int l1ctl_rx_tch_mode_req(struct osmo_trxcon_inst *trxcon, struct msgb *msg)
{
struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_tch_mode_req *mode_req;
@@ -733,10 +733,10 @@
struct l1ctl_hdr *l1h = (struct l1ctl_hdr *) msg->data;
l1h->msg_type = L1CTL_TCH_MODE_CONF;
- return trxcon_l1ctl_send(trxcon, msg);
+ return osmo_trxcon_l1ctl_send(trxcon, msg);
}
-static int l1ctl_rx_crypto_req(struct trxcon_inst *trxcon, struct msgb *msg)
+static int l1ctl_rx_crypto_req(struct osmo_trxcon_inst *trxcon, struct msgb *msg)
{
struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_crypto_req *cr;
@@ -762,7 +762,7 @@
return 0;
}
-int trxcon_l1ctl_receive(struct trxcon_inst *trxcon, struct msgb *msg)
+int osmo_trxcon_l1ctl_receive(struct osmo_trxcon_inst *trxcon, struct msgb *msg)
{
struct l1ctl_hdr *l1h;
diff --git a/src/host/trxcon/src/logging.c b/src/host/trxcon/src/logging.c
index f5fdacc..34fb06d 100644
--- a/src/host/trxcon/src/logging.c
+++ b/src/host/trxcon/src/logging.c
@@ -81,7 +81,7 @@
if (category_mask)
log_parse_category_mask(osmo_stderr_target, category_mask);
- const struct trxcon_log_cfg cfg = {
+ const struct osmo_trxcon_log_cfg cfg = {
.fsm = DAPP,
.l1c = DL1C,
.l1d = DL1D,
@@ -89,7 +89,7 @@
.schd = DSCHD,
};
- trxcon_set_log_cfg(&cfg);
+ osmo_trxcon_set_log_cfg(&cfg);
return 0;
}
diff --git a/src/host/trxcon/src/trx_if.c b/src/host/trxcon/src/trx_if.c
index 77001ac..cc0599f 100644
--- a/src/host/trxcon/src/trx_if.c
+++ b/src/host/trxcon/src/trx_if.c
@@ -275,7 +275,7 @@
*/
static int trx_if_cmd_setslot(struct trx_instance *trx,
- const struct phyif_cmdp_setslot *cmdp)
+ const struct osmo_trxcon_phyif_cmdp_setslot *cmdp)
{
/* Values correspond to 'enum ChannelCombination' in osmo-trx.git */
static const uint8_t chan_types[_GSM_PCHAN_MAX] = {
@@ -308,7 +308,7 @@
*/
static int trx_if_cmd_rxtune(struct trx_instance *trx,
- const struct phyif_cmdp_setfreq_h0 *cmdp)
+ const struct osmo_trxcon_phyif_cmdp_setfreq_h0 *cmdp)
{
uint16_t freq10;
@@ -323,7 +323,7 @@
}
static int trx_if_cmd_txtune(struct trx_instance *trx,
- const struct phyif_cmdp_setfreq_h0 *cmdp)
+ const struct osmo_trxcon_phyif_cmdp_setfreq_h0 *cmdp)
{
uint16_t freq10;
@@ -350,7 +350,7 @@
*/
static int trx_if_cmd_measure(struct trx_instance *trx,
- const struct phyif_cmdp_measure *cmdp)
+ const struct osmo_trxcon_phyif_cmdp_measure *cmdp)
{
uint16_t freq10;
@@ -382,15 +382,15 @@
return;
}
- const struct phyif_rsp rsp = {
- .type = PHYIF_CMDT_MEASURE,
+ const struct osmo_trxcon_phyif_rsp rsp = {
+ .type = OSMO_TRXCON_PHYIF_CMDT_MEASURE,
.param.measure = {
.band_arfcn = band_arfcn,
.dbm = dbm,
},
};
- phyif_handle_rsp(trx, &rsp);
+ osmo_trxcon_phyif_handle_rsp(trx, &rsp);
}
/*
@@ -407,7 +407,7 @@
*/
static int trx_if_cmd_setta(struct trx_instance *trx,
- const struct phyif_cmdp_setta *cmdp)
+ const struct osmo_trxcon_phyif_cmdp_setta *cmdp)
{
return trx_ctrl_cmd(trx, 0, "SETTA", "%d", cmdp->ta);
}
@@ -426,7 +426,7 @@
*/
static int trx_if_cmd_setfh(struct trx_instance *trx,
- const struct phyif_cmdp_setfreq_h1 *cmdp)
+ const struct osmo_trxcon_phyif_cmdp_setfreq_h1 *cmdp)
{
/* Reserve some room for CMD SETFH <HSN> <MAIO> */
char ma_buf[TRXC_BUF_SIZE - 24];
@@ -560,38 +560,39 @@
return -EIO;
}
-int trx_if_handle_phyif_cmd(struct trx_instance *trx, const struct phyif_cmd *cmd)
+int trx_if_handle_phyif_cmd(struct trx_instance *trx,
+ const struct osmo_trxcon_phyif_cmd *cmd)
{
int rc;
switch (cmd->type) {
- case PHYIF_CMDT_RESET:
+ case OSMO_TRXCON_PHYIF_CMDT_RESET:
if ((rc = trx_if_cmd_poweroff(trx)) != 0)
return rc;
rc = trx_if_cmd_echo(trx);
break;
- case PHYIF_CMDT_POWERON:
+ case OSMO_TRXCON_PHYIF_CMDT_POWERON:
rc = trx_if_cmd_poweron(trx);
break;
- case PHYIF_CMDT_POWEROFF:
+ case OSMO_TRXCON_PHYIF_CMDT_POWEROFF:
rc = trx_if_cmd_poweroff(trx);
break;
- case PHYIF_CMDT_MEASURE:
+ case OSMO_TRXCON_PHYIF_CMDT_MEASURE:
rc = trx_if_cmd_measure(trx, &cmd->param.measure);
break;
- case PHYIF_CMDT_SETFREQ_H0:
+ case OSMO_TRXCON_PHYIF_CMDT_SETFREQ_H0:
if ((rc = trx_if_cmd_rxtune(trx, &cmd->param.setfreq_h0)) != 0)
return rc;
if ((rc = trx_if_cmd_txtune(trx, &cmd->param.setfreq_h0)) != 0)
return rc;
break;
- case PHYIF_CMDT_SETFREQ_H1:
+ case OSMO_TRXCON_PHYIF_CMDT_SETFREQ_H1:
rc = trx_if_cmd_setfh(trx, &cmd->param.setfreq_h1);
break;
- case PHYIF_CMDT_SETSLOT:
+ case OSMO_TRXCON_PHYIF_CMDT_SETSLOT:
rc = trx_if_cmd_setslot(trx, &cmd->param.setslot);
break;
- case PHYIF_CMDT_SETTA:
+ case OSMO_TRXCON_PHYIF_CMDT_SETTA:
rc = trx_if_cmd_setta(trx, &cmd->param.setta);
break;
default:
@@ -628,7 +629,7 @@
static int trx_data_rx_cb(struct osmo_fd *ofd, unsigned int what)
{
struct trx_instance *trx = ofd->data;
- struct phyif_burst_ind bi;
+ struct osmo_trxcon_phyif_bi bi;
uint8_t buf[TRXD_BUF_SIZE];
ssize_t read_len;
@@ -644,7 +645,7 @@
return -EINVAL;
}
- bi = (struct phyif_burst_ind) {
+ bi = (struct osmo_trxcon_phyif_bi) {
.tn = buf[0],
.fn = osmo_load32be(buf + 1),
.rssi = -(int8_t) buf[5],
@@ -675,11 +676,11 @@
"RX burst tn=%u fn=%u rssi=%d toa=%d\n",
bi.tn, bi.fn, bi.rssi, bi.toa256);
- return phyif_handle_burst_ind(trx, &bi);
+ return osmo_trxcon_phyif_handle_bi(trx, &bi);
}
-int trx_if_handle_phyif_burst_req(struct trx_instance *trx,
- const struct phyif_burst_req *br)
+int trx_if_handle_phyif_br(struct trx_instance *trx,
+ const struct osmo_trxcon_phyif_br *br)
{
uint8_t buf[TRXD_BUF_SIZE];
size_t length;
diff --git a/src/host/trxcon/src/trxcon_fsm.c b/src/host/trxcon/src/trxcon_fsm.c
index 9980344..d5ba826 100644
--- a/src/host/trxcon/src/trxcon_fsm.c
+++ b/src/host/trxcon/src/trxcon_fsm.c
@@ -40,8 +40,8 @@
static void trxcon_allstate_action(struct osmo_fsm_inst *fi,
uint32_t event, void *data)
{
- struct trxcon_inst *trxcon = fi->priv;
- struct phyif_cmd phycmd = { };
+ struct osmo_trxcon_inst *trxcon = fi->priv;
+ struct osmo_trxcon_phyif_cmd phycmd = { };
switch (event) {
case TRXCON_EV_PHYIF_FAILURE:
@@ -58,8 +58,8 @@
osmo_fsm_inst_state_chg(fi, TRXCON_ST_RESET, 0, 0);
l1sched_reset(trxcon->sched, true);
- phycmd.type = PHYIF_CMDT_RESET;
- phyif_handle_cmd(trxcon->phyif, &phycmd);
+ phycmd.type = OSMO_TRXCON_PHYIF_CMDT_RESET;
+ osmo_trxcon_phyif_handle_cmd(trxcon->phyif, &phycmd);
break;
case TRXCON_EV_RESET_SCHED_REQ:
l1sched_reset(trxcon->sched, false);
@@ -70,16 +70,16 @@
switch (req->type) {
case TRXCON_PHY_CFGT_PCHAN_COMB:
- phycmd.type = PHYIF_CMDT_SETSLOT;
+ phycmd.type = OSMO_TRXCON_PHYIF_CMDT_SETSLOT;
phycmd.param.setslot.tn = req->pchan_comb.tn;
phycmd.param.setslot.pchan = req->pchan_comb.pchan;
- phyif_handle_cmd(trxcon->phyif, &phycmd);
+ osmo_trxcon_phyif_handle_cmd(trxcon->phyif, &phycmd);
break;
case TRXCON_PHY_CFGT_TX_PARAMS:
if (trxcon->l1p.ta != req->tx_params.timing_advance) {
- phycmd.type = PHYIF_CMDT_SETTA;
+ phycmd.type = OSMO_TRXCON_PHYIF_CMDT_SETTA;
phycmd.param.setta.ta = req->tx_params.timing_advance;
- phyif_handle_cmd(trxcon->phyif, &phycmd);
+ osmo_trxcon_phyif_handle_cmd(trxcon->phyif, &phycmd);
}
trxcon->l1p.tx_power = req->tx_params.tx_power;
trxcon->l1p.ta = req->tx_params.timing_advance;
@@ -110,7 +110,7 @@
static int trxcon_timer_cb(struct osmo_fsm_inst *fi)
{
- struct trxcon_inst *trxcon = fi->priv;
+ struct osmo_trxcon_inst *trxcon = fi->priv;
switch (fi->state) {
case TRXCON_ST_FBSB_SEARCH:
@@ -125,7 +125,7 @@
static void handle_full_power_scan_req(struct osmo_fsm_inst *fi,
const struct trxcon_param_full_power_scan_req *req)
{
- struct trxcon_inst *trxcon = fi->priv;
+ struct osmo_trxcon_inst *trxcon = fi->priv;
enum gsm_band band_start, band_stop;
if (trxcon->fi_data != NULL) {
@@ -144,14 +144,14 @@
trxcon->fi_data = talloc_memdup(fi, req, sizeof(*req));
OSMO_ASSERT(trxcon->fi_data != NULL);
- /* trxcon_st_full_power_scan_onenter() sends the initial PHYIF_CMDT_MEASURE */
+ /* trxcon_st_full_power_scan_onenter() sends the initial OSMO_TRXCON_PHYIF_CMDT_MEASURE */
osmo_fsm_inst_state_chg(fi, TRXCON_ST_FULL_POWER_SCAN, 0, 0); /* TODO: timeout */
}
static void trxcon_st_reset_action(struct osmo_fsm_inst *fi,
uint32_t event, void *data)
{
- struct trxcon_inst *trxcon = fi->priv;
+ struct osmo_trxcon_inst *trxcon = fi->priv;
switch (event) {
case TRXCON_EV_FBSB_SEARCH_REQ:
@@ -164,8 +164,8 @@
/* Only if current ARFCN differs */
if (trxcon->l1p.band_arfcn != req->band_arfcn) {
- const struct phyif_cmd phycmd = {
- .type = PHYIF_CMDT_SETFREQ_H0,
+ const struct osmo_trxcon_phyif_cmd phycmd = {
+ .type = OSMO_TRXCON_PHYIF_CMDT_SETFREQ_H0,
.param.setfreq_h0 = {
.band_arfcn = req->band_arfcn,
},
@@ -175,11 +175,11 @@
trxcon->l1p.band_arfcn = req->band_arfcn;
/* Tune transceiver to required ARFCN */
- phyif_handle_cmd(trxcon->phyif, &phycmd);
+ osmo_trxcon_phyif_handle_cmd(trxcon->phyif, &phycmd);
}
- const struct phyif_cmd phycmd = { .type = PHYIF_CMDT_POWERON };
- phyif_handle_cmd(trxcon->phyif, &phycmd);
+ const struct osmo_trxcon_phyif_cmd phycmd = { .type = OSMO_TRXCON_PHYIF_CMDT_POWERON };
+ osmo_trxcon_phyif_handle_cmd(trxcon->phyif, &phycmd);
break;
}
case TRXCON_EV_FULL_POWER_SCAN_REQ:
@@ -193,24 +193,24 @@
static void trxcon_st_full_power_scan_onenter(struct osmo_fsm_inst *fi,
uint32_t prev_state)
{
- const struct trxcon_inst *trxcon = fi->priv;
+ const struct osmo_trxcon_inst *trxcon = fi->priv;
const struct trxcon_param_full_power_scan_req *req = trxcon->fi_data;
/* req->band_arfcn_start holds the current ARFCN */
- const struct phyif_cmd phycmd = {
- .type = PHYIF_CMDT_MEASURE,
+ const struct osmo_trxcon_phyif_cmd phycmd = {
+ .type = OSMO_TRXCON_PHYIF_CMDT_MEASURE,
.param.measure = {
.band_arfcn = req->band_arfcn_start,
},
};
- phyif_handle_cmd(trxcon->phyif, &phycmd);
+ osmo_trxcon_phyif_handle_cmd(trxcon->phyif, &phycmd);
}
static void trxcon_st_full_power_scan_action(struct osmo_fsm_inst *fi,
uint32_t event, void *data)
{
- struct trxcon_inst *trxcon = fi->priv;
+ struct osmo_trxcon_inst *trxcon = fi->priv;
switch (event) {
case TRXCON_EV_FULL_POWER_SCAN_RES:
@@ -234,7 +234,7 @@
if (res->band_arfcn < req->band_arfcn_stop) {
l1ctl_tx_pm_conf(trxcon, res->band_arfcn, res->dbm, false);
- /* trxcon_st_full_power_scan_onenter() sends the next PHYIF_CMDT_MEASURE */
+ /* trxcon_st_full_power_scan_onenter() sends the next OSMO_TRXCON_PHYIF_CMDT_MEASURE */
req->band_arfcn_start = res->band_arfcn + 1;
osmo_fsm_inst_state_chg(fi, TRXCON_ST_FULL_POWER_SCAN, 0, 0); /* TODO: timeout */
} else {
@@ -255,7 +255,7 @@
static void trxcon_st_fbsb_search_action(struct osmo_fsm_inst *fi,
uint32_t event, void *data)
{
- struct trxcon_inst *trxcon = fi->priv;
+ struct osmo_trxcon_inst *trxcon = fi->priv;
switch (event) {
case TRXCON_EV_FBSB_SEARCH_RES:
@@ -270,7 +270,7 @@
static void handle_tx_access_burst_req(struct osmo_fsm_inst *fi,
const struct trxcon_param_tx_access_burst_req *req)
{
- struct trxcon_inst *trxcon = fi->priv;
+ struct osmo_trxcon_inst *trxcon = fi->priv;
enum l1sched_ts_prim_type prim_type;
const struct l1sched_ts_prim *prim;
@@ -291,7 +291,7 @@
static void trxcon_st_bcch_ccch_action(struct osmo_fsm_inst *fi,
uint32_t event, void *data)
{
- struct trxcon_inst *trxcon = fi->priv;
+ struct osmo_trxcon_inst *trxcon = fi->priv;
struct l1sched_ts *ts;
int rc;
@@ -332,8 +332,8 @@
}
if (req->hopping) {
- const struct phyif_cmd phycmd = {
- .type = PHYIF_CMDT_SETFREQ_H1,
+ const struct osmo_trxcon_phyif_cmd phycmd = {
+ .type = OSMO_TRXCON_PHYIF_CMDT_SETFREQ_H1,
.param.setfreq_h1 = {
.hsn = req->h1.hsn,
.maio = req->h1.maio,
@@ -343,21 +343,21 @@
};
/* Apply the freq. hopping parameters */
- if (phyif_handle_cmd(trxcon->phyif, &phycmd) != 0)
+ if (osmo_trxcon_phyif_handle_cmd(trxcon->phyif, &phycmd) != 0)
return;
/* Set current ARFCN to an invalid value */
trxcon->l1p.band_arfcn = 0xffff;
} else {
- const struct phyif_cmd phycmd = {
- .type = PHYIF_CMDT_SETFREQ_H0,
+ const struct osmo_trxcon_phyif_cmd phycmd = {
+ .type = OSMO_TRXCON_PHYIF_CMDT_SETFREQ_H0,
.param.setfreq_h0 = {
.band_arfcn = req->h0.band_arfcn,
},
};
/* Tune transceiver to required ARFCN */
- if (phyif_handle_cmd(trxcon->phyif, &phycmd) != 0)
+ if (osmo_trxcon_phyif_handle_cmd(trxcon->phyif, &phycmd) != 0)
return;
/* Update current ARFCN */
@@ -396,7 +396,7 @@
static void trxcon_st_dedicated_action(struct osmo_fsm_inst *fi,
uint32_t event, void *data)
{
- struct trxcon_inst *trxcon = fi->priv;
+ struct osmo_trxcon_inst *trxcon = fi->priv;
switch (event) {
case TRXCON_EV_TX_ACCESS_BURST_REQ:
@@ -506,7 +506,7 @@
static void trxcon_st_packet_data_action(struct osmo_fsm_inst *fi,
uint32_t event, void *data)
{
- struct trxcon_inst *trxcon = fi->priv;
+ struct osmo_trxcon_inst *trxcon = fi->priv;
switch (event) {
case TRXCON_EV_TX_ACCESS_BURST_REQ:
@@ -537,7 +537,7 @@
static void trxcon_fsm_pre_term_cb(struct osmo_fsm_inst *fi,
enum osmo_fsm_term_cause cause)
{
- struct trxcon_inst *trxcon = fi->priv;
+ struct osmo_trxcon_inst *trxcon = fi->priv;
if (trxcon == NULL)
return;
@@ -547,9 +547,9 @@
l1sched_free(trxcon->sched);
/* Close active connections */
if (trxcon->l2if != NULL)
- trxcon_l1ctl_close(trxcon);
+ osmo_trxcon_l1ctl_close(trxcon);
if (trxcon->phyif != NULL)
- phyif_close(trxcon->phyif);
+ osmo_trxcon_phyif_close(trxcon->phyif);
talloc_free(trxcon);
fi->priv = NULL;
diff --git a/src/host/trxcon/src/trxcon_inst.c b/src/host/trxcon/src/trxcon_inst.c
index 5d96021..c8454bb 100644
--- a/src/host/trxcon/src/trxcon_inst.c
+++ b/src/host/trxcon/src/trxcon_inst.c
@@ -31,7 +31,7 @@
extern int g_logc_l1c;
extern int g_logc_l1d;
-void trxcon_set_log_cfg(const struct trxcon_log_cfg *cfg)
+void osmo_trxcon_set_log_cfg(const struct osmo_trxcon_log_cfg *cfg)
{
l1sched_logging_init(cfg->schc, cfg->schd);
trxcon_fsm_def.log_subsys = cfg->fsm;
@@ -39,15 +39,15 @@
g_logc_l1d = cfg->l1d;
}
-struct trxcon_inst *trxcon_inst_alloc(void *ctx, unsigned int id, uint32_t fn_advance)
+struct osmo_trxcon_inst *osmo_trxcon_inst_alloc(void *ctx, unsigned int id, uint32_t fn_advance)
{
- struct trxcon_inst *trxcon;
+ struct osmo_trxcon_inst *trxcon;
struct osmo_fsm_inst *fi;
fi = osmo_fsm_inst_alloc(&trxcon_fsm_def, ctx, NULL, LOGL_DEBUG, NULL);
OSMO_ASSERT(fi != NULL);
- trxcon = talloc_zero(fi, struct trxcon_inst);
+ trxcon = talloc_zero(fi, struct osmo_trxcon_inst);
OSMO_ASSERT(trxcon != NULL);
fi->priv = trxcon;
@@ -67,14 +67,14 @@
trxcon->sched = l1sched_alloc(trxcon, &sched_cfg, trxcon);
if (trxcon->sched == NULL) {
- trxcon_inst_free(trxcon);
+ osmo_trxcon_inst_free(trxcon);
return NULL;
}
return trxcon;
}
-void trxcon_inst_free(struct trxcon_inst *trxcon)
+void osmo_trxcon_inst_free(struct osmo_trxcon_inst *trxcon)
{
if (trxcon == NULL || trxcon->fi == NULL)
return;
diff --git a/src/host/trxcon/src/trxcon_main.c b/src/host/trxcon/src/trxcon_main.c
index 94deeab..ebdc3b2 100644
--- a/src/host/trxcon/src/trxcon_main.c
+++ b/src/host/trxcon/src/trxcon_main.c
@@ -109,7 +109,7 @@
int l1sched_handle_config_req(struct l1sched_state *sched,
const struct l1sched_config_req *cr)
{
- struct trxcon_inst *trxcon = sched->priv;
+ struct osmo_trxcon_inst *trxcon = sched->priv;
switch (cr->type) {
case L1SCHED_CFG_PCHAN_COMB:
@@ -134,8 +134,8 @@
int l1sched_handle_burst_req(struct l1sched_state *sched,
const struct l1sched_burst_req *br)
{
- struct trxcon_inst *trxcon = sched->priv;
- const struct phyif_burst_req phybr = {
+ struct osmo_trxcon_inst *trxcon = sched->priv;
+ const struct osmo_trxcon_phyif_br phybr = {
.fn = br->fn,
.tn = br->tn,
.pwr = br->pwr,
@@ -143,14 +143,14 @@
.burst_len = br->burst_len,
};
- return phyif_handle_burst_req(trxcon->phyif, &phybr);
+ return osmo_trxcon_phyif_handle_br(trxcon->phyif, &phybr);
}
/* External L1 API for the PHYIF */
-int phyif_handle_burst_ind(void *phyif, const struct phyif_burst_ind *bi)
+int osmo_trxcon_phyif_handle_bi(void *phyif, const struct osmo_trxcon_phyif_bi *bi)
{
struct trx_instance *trx = phyif;
- struct trxcon_inst *trxcon = trx->priv;
+ struct osmo_trxcon_inst *trxcon = trx->priv;
const struct l1sched_meas_set meas = {
.fn = bi->fn,
.toa256 = bi->toa256,
@@ -168,25 +168,25 @@
return 0;
}
-int phyif_handle_burst_req(void *phyif, const struct phyif_burst_req *br)
+int osmo_trxcon_phyif_handle_br(void *phyif, const struct osmo_trxcon_phyif_br *br)
{
- return trx_if_handle_phyif_burst_req(phyif, br);
+ return trx_if_handle_phyif_br(phyif, br);
}
-int phyif_handle_cmd(void *phyif, const struct phyif_cmd *cmd)
+int osmo_trxcon_phyif_handle_cmd(void *phyif, const struct osmo_trxcon_phyif_cmd *cmd)
{
return trx_if_handle_phyif_cmd(phyif, cmd);
}
-int phyif_handle_rsp(void *phyif, const struct phyif_rsp *rsp)
+int osmo_trxcon_phyif_handle_rsp(void *phyif, const struct osmo_trxcon_phyif_rsp *rsp)
{
struct trx_instance *trx = phyif;
- struct trxcon_inst *trxcon = trx->priv;
+ struct osmo_trxcon_inst *trxcon = trx->priv;
switch (rsp->type) {
- case PHYIF_CMDT_MEASURE:
+ case OSMO_TRXCON_PHYIF_CMDT_MEASURE:
{
- const struct phyif_rspp_measure *meas = &rsp->param.measure;
+ const struct osmo_trxcon_phyif_rspp_measure *meas = &rsp->param.measure;
struct trxcon_param_full_power_scan_res res = {
.band_arfcn = meas->band_arfcn,
.dbm = meas->dbm,
@@ -201,7 +201,7 @@
}
}
-void phyif_close(void *phyif)
+void osmo_trxcon_phyif_close(void *phyif)
{
trx_if_close(phyif);
}
@@ -215,7 +215,7 @@
const struct l1sched_meas_set *meas = &lchan->meas_avg;
const struct l1sched_lchan_desc *lchan_desc;
struct l1sched_state *sched = lchan->ts->sched;
- struct trxcon_inst *trxcon = sched->priv;
+ struct osmo_trxcon_inst *trxcon = sched->priv;
int rc;
lchan_desc = &l1sched_lchan_desc[lchan->type];
@@ -270,7 +270,7 @@
{
const struct l1sched_lchan_desc *lchan_desc;
struct l1sched_state *sched = lchan->ts->sched;
- struct trxcon_inst *trxcon = sched->priv;
+ struct osmo_trxcon_inst *trxcon = sched->priv;
bool is_traffic = false;
const uint8_t *data;
uint8_t ra_buf[2];
@@ -336,7 +336,7 @@
return rc;
}
-void trxcon_l1ctl_close(struct trxcon_inst *trxcon)
+void osmo_trxcon_l1ctl_close(struct osmo_trxcon_inst *trxcon)
{
/* Avoid use-after-free: both *fi and *trxcon are children of
* the L2IF (L1CTL connection), so we need to re-parent *fi
@@ -345,7 +345,7 @@
l1ctl_client_conn_close(trxcon->l2if);
}
-int trxcon_l1ctl_send(struct trxcon_inst *trxcon, struct msgb *msg)
+int osmo_trxcon_l1ctl_send(struct osmo_trxcon_inst *trxcon, struct msgb *msg)
{
struct l1ctl_client *l1c = trxcon->l2if;
@@ -354,16 +354,16 @@
static int l1ctl_rx_cb(struct l1ctl_client *l1c, struct msgb *msg)
{
- struct trxcon_inst *trxcon = l1c->priv;
+ struct osmo_trxcon_inst *trxcon = l1c->priv;
- return trxcon_l1ctl_receive(trxcon, msg);
+ return osmo_trxcon_l1ctl_receive(trxcon, msg);
}
static void l1ctl_conn_accept_cb(struct l1ctl_client *l1c)
{
- struct trxcon_inst *trxcon;
+ struct osmo_trxcon_inst *trxcon;
- trxcon = trxcon_inst_alloc(l1c, l1c->id, app_data.trx_fn_advance);
+ trxcon = osmo_trxcon_inst_alloc(l1c, l1c->id, app_data.trx_fn_advance);
if (trxcon == NULL) {
l1ctl_client_conn_close(l1c);
return;
@@ -395,7 +395,7 @@
static void l1ctl_conn_close_cb(struct l1ctl_client *l1c)
{
- struct trxcon_inst *trxcon = l1c->priv;
+ struct osmo_trxcon_inst *trxcon = l1c->priv;
if (trxcon == NULL || trxcon->fi == NULL)
return;
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/30102
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I0c5b8642c9c436e8beab0dc80fb7fd96cda25547
Gerrit-Change-Number: 30102
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange
1
0
12 Nov '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/30099 )
Change subject: trxcon: use L1CTL_HEADROOM in l1ctl_alloc_msg()
......................................................................
trxcon: use L1CTL_HEADROOM in l1ctl_alloc_msg()
The l1ctl_client_read_cb() is using L1CTL_HEADROOM, so let's avoid
inconsistency and use L1CTL_HEADROOM in the l1ctl_alloc_msg() too.
Change-Id: I248f8c662ae0836cba61fb708a5dc73c57131f4c
Related: OS#5599
---
M src/host/trxcon/src/l1ctl.c
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/99/30099/1
diff --git a/src/host/trxcon/src/l1ctl.c b/src/host/trxcon/src/l1ctl.c
index 4923899..0075fcc 100644
--- a/src/host/trxcon/src/l1ctl.c
+++ b/src/host/trxcon/src/l1ctl.c
@@ -62,8 +62,8 @@
* Each L1CTL message gets its own length pushed in front
* before sending. This is why we need this small headroom.
*/
- msg = msgb_alloc_headroom(L1CTL_LENGTH + L1CTL_MSG_LEN_FIELD,
- L1CTL_MSG_LEN_FIELD, "l1ctl_tx_msg");
+ msg = msgb_alloc_headroom(L1CTL_LENGTH + L1CTL_HEADROOM,
+ L1CTL_HEADROOM, "l1ctl_tx_msg");
if (!msg) {
LOGP(DL1C, LOGL_ERROR, "Failed to allocate memory\n");
return NULL;
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/30099
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I248f8c662ae0836cba61fb708a5dc73c57131f4c
Gerrit-Change-Number: 30099
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange
1
0
Change in osmocom-bb[master]: trxcon: abstract L1CTL codec from the l1ctl_server API
by fixeria 12 Nov '22
by fixeria 12 Nov '22
12 Nov '22
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/30100 )
Change subject: trxcon: abstract L1CTL codec from the l1ctl_server API
......................................................................
trxcon: abstract L1CTL codec from the l1ctl_server API
The L1CTL codec (implemented in l1ctl.c) is going to be part of the
upcoming libtrxcon, so let's uncouple it from the l1ctl_server API.
Change-Id: I8d80af240b0e57f76263907c552288d4184876c0
Related: OS#5599
---
M src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
M src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
M src/host/trxcon/src/l1ctl.c
M src/host/trxcon/src/trxcon_fsm.c
M src/host/trxcon/src/trxcon_main.c
5 files changed, 128 insertions(+), 110 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/00/30100/1
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
index 1a8d775..949960c 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
@@ -1,24 +1,22 @@
#pragma once
#include <stdint.h>
-#include <osmocom/core/msgb.h>
-#include <osmocom/bb/trxcon/l1ctl_server.h>
+struct msgb;
+struct trxcon_param_rx_data_ind;
+struct trxcon_param_tx_data_cnf;
+struct trxcon_param_tx_access_burst_cnf;
-/* Event handlers */
-int l1ctl_rx_cb(struct l1ctl_client *l1c, struct msgb *msg);
+int l1ctl_tx_fbsb_conf(struct trxcon_inst *trxcon, uint16_t band_arfcn, uint8_t bsic);
+int l1ctl_tx_fbsb_fail(struct trxcon_inst *trxcon, uint16_t band_arfcn);
+int l1ctl_tx_ccch_mode_conf(struct trxcon_inst *trxcon, uint8_t mode);
+int l1ctl_tx_pm_conf(struct trxcon_inst *trxcon, uint16_t band_arfcn, int dbm, int last);
+int l1ctl_tx_reset_conf(struct trxcon_inst *trxcon, uint8_t type);
+int l1ctl_tx_reset_ind(struct trxcon_inst *trxcon, uint8_t type);
-int l1ctl_tx_fbsb_conf(struct l1ctl_client *l1c, uint16_t band_arfcn, uint8_t bsic);
-int l1ctl_tx_fbsb_fail(struct l1ctl_client *l1c, uint16_t band_arfcn);
-int l1ctl_tx_ccch_mode_conf(struct l1ctl_client *l1c, uint8_t mode);
-int l1ctl_tx_pm_conf(struct l1ctl_client *l1c, uint16_t band_arfcn,
- int dbm, int last);
-int l1ctl_tx_reset_conf(struct l1ctl_client *l1c, uint8_t type);
-int l1ctl_tx_reset_ind(struct l1ctl_client *l1c, uint8_t type);
-
-int l1ctl_tx_dt_ind(struct l1ctl_client *l1c,
+int l1ctl_tx_dt_ind(struct trxcon_inst *trxcon,
const struct trxcon_param_rx_data_ind *ind);
-int l1ctl_tx_dt_conf(struct l1ctl_client *l1c,
+int l1ctl_tx_dt_conf(struct trxcon_inst *trxcon,
const struct trxcon_param_tx_data_cnf *cnf);
-int l1ctl_tx_rach_conf(struct l1ctl_client *l1c,
+int l1ctl_tx_rach_conf(struct trxcon_inst *trxcon,
const struct trxcon_param_tx_access_burst_cnf *cnf);
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
index b8d3150..e5ba5ec 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
@@ -4,6 +4,7 @@
struct osmo_fsm_inst;
struct l1sched_state;
+struct msgb;
struct trxcon_inst {
struct osmo_fsm_inst *fi;
@@ -32,3 +33,7 @@
struct trxcon_inst *trxcon_inst_alloc(void *ctx, unsigned int id, uint32_t fn_advance);
void trxcon_inst_free(struct trxcon_inst *trxcon);
+
+int trxcon_l1ctl_receive(struct trxcon_inst *trxcon, struct msgb *msg);
+int trxcon_l1ctl_send(struct trxcon_inst *trxcon, struct msgb *msg);
+void trxcon_l1ctl_close(struct trxcon_inst *trxcon);
diff --git a/src/host/trxcon/src/l1ctl.c b/src/host/trxcon/src/l1ctl.c
index 0075fcc..17c136a 100644
--- a/src/host/trxcon/src/l1ctl.c
+++ b/src/host/trxcon/src/l1ctl.c
@@ -38,11 +38,13 @@
#include <osmocom/gsm/protocol/gsm_08_58.h>
#include <osmocom/bb/trxcon/logging.h>
-#include <osmocom/bb/trxcon/l1ctl_server.h>
#include <osmocom/bb/trxcon/l1ctl_proto.h>
#include <osmocom/bb/trxcon/trxcon.h>
#include <osmocom/bb/trxcon/trxcon_fsm.h>
+#define L1CTL_LENGTH 256
+#define L1CTL_HEADROOM 32
+
static const char *arfcn2band_name(uint16_t arfcn)
{
enum gsm_band band;
@@ -76,10 +78,9 @@
return msg;
}
-int l1ctl_tx_pm_conf(struct l1ctl_client *l1c, uint16_t band_arfcn,
- int dbm, int last)
+int l1ctl_tx_pm_conf(struct trxcon_inst *trxcon, uint16_t band_arfcn, int dbm, int last)
{
- struct osmo_fsm_inst *fi = l1c->priv;
+ struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_pm_conf *pmc;
struct msgb *msg;
@@ -102,12 +103,12 @@
l1h->flags |= L1CTL_F_DONE;
}
- return l1ctl_client_send(l1c, msg);
+ return trxcon_l1ctl_send(trxcon, msg);
}
-int l1ctl_tx_reset_ind(struct l1ctl_client *l1c, uint8_t type)
+int l1ctl_tx_reset_ind(struct trxcon_inst *trxcon, uint8_t type)
{
- struct osmo_fsm_inst *fi = l1c->priv;
+ struct osmo_fsm_inst *fi = trxcon->fi;
struct msgb *msg;
struct l1ctl_reset *res;
@@ -120,12 +121,12 @@
res = (struct l1ctl_reset *) msgb_put(msg, sizeof(*res));
res->type = type;
- return l1ctl_client_send(l1c, msg);
+ return trxcon_l1ctl_send(trxcon, msg);
}
-int l1ctl_tx_reset_conf(struct l1ctl_client *l1c, uint8_t type)
+int l1ctl_tx_reset_conf(struct trxcon_inst *trxcon, uint8_t type)
{
- struct osmo_fsm_inst *fi = l1c->priv;
+ struct osmo_fsm_inst *fi = trxcon->fi;
struct msgb *msg;
struct l1ctl_reset *res;
@@ -137,7 +138,7 @@
res = (struct l1ctl_reset *) msgb_put(msg, sizeof(*res));
res->type = type;
- return l1ctl_client_send(l1c, msg);
+ return trxcon_l1ctl_send(trxcon, msg);
}
static struct l1ctl_info_dl *put_dl_info_hdr(struct msgb *msg,
@@ -165,9 +166,9 @@
return conf;
}
-int l1ctl_tx_fbsb_fail(struct l1ctl_client *l1c, uint16_t band_arfcn)
+int l1ctl_tx_fbsb_fail(struct trxcon_inst *trxcon, uint16_t band_arfcn)
{
- struct osmo_fsm_inst *fi = l1c->priv;
+ struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_info_dl *dl;
struct msgb *msg;
@@ -184,12 +185,12 @@
LOGPFSMSL(fi, DL1C, LOGL_DEBUG, "Send FBSB Conf (timeout)\n");
- return l1ctl_client_send(l1c, msg);
+ return trxcon_l1ctl_send(trxcon, msg);
}
-int l1ctl_tx_fbsb_conf(struct l1ctl_client *l1c, uint16_t band_arfcn, uint8_t bsic)
+int l1ctl_tx_fbsb_conf(struct trxcon_inst *trxcon, uint16_t band_arfcn, uint8_t bsic)
{
- struct osmo_fsm_inst *fi = l1c->priv;
+ struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_fbsb_conf *conf;
struct l1ctl_info_dl *dl;
struct msgb *msg;
@@ -212,10 +213,10 @@
"Send FBSB Conf (result=%u, bsic=%u)\n",
conf->result, conf->bsic);
- return l1ctl_client_send(l1c, msg);
+ return trxcon_l1ctl_send(trxcon, msg);
}
-int l1ctl_tx_ccch_mode_conf(struct l1ctl_client *l1c, uint8_t mode)
+int l1ctl_tx_ccch_mode_conf(struct trxcon_inst *trxcon, uint8_t mode)
{
struct l1ctl_ccch_mode_conf *conf;
struct msgb *msg;
@@ -227,13 +228,13 @@
conf = (struct l1ctl_ccch_mode_conf *) msgb_put(msg, sizeof(*conf));
conf->ccch_mode = mode;
- return l1ctl_client_send(l1c, msg);
+ return trxcon_l1ctl_send(trxcon, msg);
}
/**
* Handles both L1CTL_DATA_IND and L1CTL_TRAFFIC_IND.
*/
-int l1ctl_tx_dt_ind(struct l1ctl_client *l1c,
+int l1ctl_tx_dt_ind(struct trxcon_inst *trxcon,
const struct trxcon_param_rx_data_ind *ind)
{
struct msgb *msg;
@@ -260,10 +261,10 @@
memcpy(msgb_put(msg, ind->data_len), ind->data, ind->data_len);
/* Put message to upper layers */
- return l1ctl_client_send(l1c, msg);
+ return trxcon_l1ctl_send(trxcon, msg);
}
-int l1ctl_tx_rach_conf(struct l1ctl_client *l1c,
+int l1ctl_tx_rach_conf(struct trxcon_inst *trxcon,
const struct trxcon_param_tx_access_burst_cnf *cnf)
{
struct msgb *msg;
@@ -279,14 +280,14 @@
put_dl_info_hdr(msg, &dl_hdr);
- return l1ctl_client_send(l1c, msg);
+ return trxcon_l1ctl_send(trxcon, msg);
}
/**
* Handles both L1CTL_DATA_CONF and L1CTL_TRAFFIC_CONF.
*/
-int l1ctl_tx_dt_conf(struct l1ctl_client *l1c,
+int l1ctl_tx_dt_conf(struct trxcon_inst *trxcon,
struct trxcon_param_tx_data_cnf *cnf)
{
struct msgb *msg;
@@ -305,7 +306,7 @@
/* Copy DL frame header from source message */
put_dl_info_hdr(msg, &dl_hdr);
- return l1ctl_client_send(l1c, msg);
+ return trxcon_l1ctl_send(trxcon, msg);
}
static enum gsm_phys_chan_config l1ctl_ccch_mode2pchan_config(enum ccch_mode mode)
@@ -328,9 +329,9 @@
}
}
-static int l1ctl_rx_fbsb_req(struct l1ctl_client *l1c, struct msgb *msg)
+static int l1ctl_rx_fbsb_req(struct trxcon_inst *trxcon, struct msgb *msg)
{
- struct osmo_fsm_inst *fi = l1c->priv;
+ struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_fbsb_req *fbsb;
int rc = 0;
@@ -362,9 +363,9 @@
return rc;
}
-static int l1ctl_rx_pm_req(struct l1ctl_client *l1c, struct msgb *msg)
+static int l1ctl_rx_pm_req(struct trxcon_inst *trxcon, struct msgb *msg)
{
- struct osmo_fsm_inst *fi = l1c->priv;
+ struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_pm_req *pmr;
int rc = 0;
@@ -395,9 +396,9 @@
return rc;
}
-static int l1ctl_rx_reset_req(struct l1ctl_client *l1c, struct msgb *msg)
+static int l1ctl_rx_reset_req(struct trxcon_inst *trxcon, struct msgb *msg)
{
- struct osmo_fsm_inst *fi = l1c->priv;
+ struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_reset *res;
int rc = 0;
@@ -427,16 +428,16 @@
}
/* Confirm */
- rc = l1ctl_tx_reset_conf(l1c, res->type);
+ rc = l1ctl_tx_reset_conf(trxcon, res->type);
exit:
msgb_free(msg);
return rc;
}
-static int l1ctl_rx_echo_req(struct l1ctl_client *l1c, struct msgb *msg)
+static int l1ctl_rx_echo_req(struct trxcon_inst *trxcon, struct msgb *msg)
{
- struct osmo_fsm_inst *fi = l1c->priv;
+ struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_hdr *l1h;
LOGPFSMSL(fi, DL1C, LOGL_NOTICE, "Recv Echo Req\n");
@@ -447,12 +448,12 @@
l1h->msg_type = L1CTL_ECHO_CONF;
msg->data = msg->l1h;
- return l1ctl_client_send(l1c, msg);
+ return trxcon_l1ctl_send(trxcon, msg);
}
-static int l1ctl_rx_ccch_mode_req(struct l1ctl_client *l1c, struct msgb *msg)
+static int l1ctl_rx_ccch_mode_req(struct trxcon_inst *trxcon, struct msgb *msg)
{
- struct osmo_fsm_inst *fi = l1c->priv;
+ struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_ccch_mode_req *mode_req;
int rc;
@@ -475,17 +476,17 @@
rc = osmo_fsm_inst_dispatch(fi, TRXCON_EV_SET_CCCH_MODE_REQ, &req);
if (rc == 0 && req.applied)
- l1ctl_tx_ccch_mode_conf(l1c, mode_req->ccch_mode);
+ l1ctl_tx_ccch_mode_conf(trxcon, mode_req->ccch_mode);
exit:
msgb_free(msg);
return rc;
}
-static int l1ctl_rx_rach_req(struct l1ctl_client *l1c, struct msgb *msg, bool is_11bit)
+static int l1ctl_rx_rach_req(struct trxcon_inst *trxcon, struct msgb *msg, bool is_11bit)
{
struct trxcon_param_tx_access_burst_req req;
- struct osmo_fsm_inst *fi = l1c->priv;
+ struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_info_ul *ul;
ul = (struct l1ctl_info_ul *) msg->l1h;
@@ -581,9 +582,9 @@
return 0;
}
-static int l1ctl_rx_dm_est_req(struct l1ctl_client *l1c, struct msgb *msg)
+static int l1ctl_rx_dm_est_req(struct trxcon_inst *trxcon, struct msgb *msg)
{
- struct osmo_fsm_inst *fi = l1c->priv;
+ struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_dm_est_req *est_req;
struct l1ctl_info_ul *ul;
int rc;
@@ -618,9 +619,9 @@
return rc;
}
-static int l1ctl_rx_dm_rel_req(struct l1ctl_client *l1c, struct msgb *msg)
+static int l1ctl_rx_dm_rel_req(struct trxcon_inst *trxcon, struct msgb *msg)
{
- struct osmo_fsm_inst *fi = l1c->priv;
+ struct osmo_fsm_inst *fi = trxcon->fi;
LOGPFSMSL(fi, DL1C, LOGL_NOTICE, "Received L1CTL_DM_REL_REQ\n");
@@ -633,10 +634,9 @@
/**
* Handles both L1CTL_DATA_REQ and L1CTL_TRAFFIC_REQ.
*/
-static int l1ctl_rx_dt_req(struct l1ctl_client *l1c,
- struct msgb *msg, bool traffic)
+static int l1ctl_rx_dt_req(struct trxcon_inst *trxcon, struct msgb *msg, bool traffic)
{
- struct osmo_fsm_inst *fi = l1c->priv;
+ struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_info_ul *ul;
/* Extract UL frame header */
@@ -669,9 +669,9 @@
return 0;
}
-static int l1ctl_rx_param_req(struct l1ctl_client *l1c, struct msgb *msg)
+static int l1ctl_rx_param_req(struct trxcon_inst *trxcon, struct msgb *msg)
{
- struct osmo_fsm_inst *fi = l1c->priv;
+ struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_par_req *par_req;
struct l1ctl_info_ul *ul;
@@ -696,9 +696,9 @@
return 0;
}
-static int l1ctl_rx_tch_mode_req(struct l1ctl_client *l1c, struct msgb *msg)
+static int l1ctl_rx_tch_mode_req(struct trxcon_inst *trxcon, struct msgb *msg)
{
- struct osmo_fsm_inst *fi = l1c->priv;
+ struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_tch_mode_req *mode_req;
int rc;
@@ -728,12 +728,12 @@
struct l1ctl_hdr *l1h = (struct l1ctl_hdr *) msg->data;
l1h->msg_type = L1CTL_TCH_MODE_CONF;
- return l1ctl_client_send(l1c, msg);
+ return trxcon_l1ctl_send(trxcon, msg);
}
-static int l1ctl_rx_crypto_req(struct l1ctl_client *l1c, struct msgb *msg)
+static int l1ctl_rx_crypto_req(struct trxcon_inst *trxcon, struct msgb *msg)
{
- struct osmo_fsm_inst *fi = l1c->priv;
+ struct osmo_fsm_inst *fi = trxcon->fi;
struct l1ctl_crypto_req *cr;
struct l1ctl_info_ul *ul;
@@ -757,9 +757,8 @@
return 0;
}
-int l1ctl_rx_cb(struct l1ctl_client *l1c, struct msgb *msg)
+int trxcon_l1ctl_receive(struct trxcon_inst *trxcon, struct msgb *msg)
{
- struct osmo_fsm_inst *fi = l1c->priv;
struct l1ctl_hdr *l1h;
l1h = (struct l1ctl_hdr *) msg->l1h;
@@ -767,33 +766,33 @@
switch (l1h->msg_type) {
case L1CTL_FBSB_REQ:
- return l1ctl_rx_fbsb_req(l1c, msg);
+ return l1ctl_rx_fbsb_req(trxcon, msg);
case L1CTL_PM_REQ:
- return l1ctl_rx_pm_req(l1c, msg);
+ return l1ctl_rx_pm_req(trxcon, msg);
case L1CTL_RESET_REQ:
- return l1ctl_rx_reset_req(l1c, msg);
+ return l1ctl_rx_reset_req(trxcon, msg);
case L1CTL_ECHO_REQ:
- return l1ctl_rx_echo_req(l1c, msg);
+ return l1ctl_rx_echo_req(trxcon, msg);
case L1CTL_CCCH_MODE_REQ:
- return l1ctl_rx_ccch_mode_req(l1c, msg);
+ return l1ctl_rx_ccch_mode_req(trxcon, msg);
case L1CTL_RACH_REQ:
- return l1ctl_rx_rach_req(l1c, msg, false);
+ return l1ctl_rx_rach_req(trxcon, msg, false);
case L1CTL_EXT_RACH_REQ:
- return l1ctl_rx_rach_req(l1c, msg, true);
+ return l1ctl_rx_rach_req(trxcon, msg, true);
case L1CTL_DM_EST_REQ:
- return l1ctl_rx_dm_est_req(l1c, msg);
+ return l1ctl_rx_dm_est_req(trxcon, msg);
case L1CTL_DM_REL_REQ:
- return l1ctl_rx_dm_rel_req(l1c, msg);
+ return l1ctl_rx_dm_rel_req(trxcon, msg);
case L1CTL_DATA_REQ:
- return l1ctl_rx_dt_req(l1c, msg, false);
+ return l1ctl_rx_dt_req(trxcon, msg, false);
case L1CTL_TRAFFIC_REQ:
- return l1ctl_rx_dt_req(l1c, msg, true);
+ return l1ctl_rx_dt_req(trxcon, msg, true);
case L1CTL_PARAM_REQ:
- return l1ctl_rx_param_req(l1c, msg);
+ return l1ctl_rx_param_req(trxcon, msg);
case L1CTL_TCH_MODE_REQ:
- return l1ctl_rx_tch_mode_req(l1c, msg);
+ return l1ctl_rx_tch_mode_req(trxcon, msg);
case L1CTL_CRYPTO_REQ:
- return l1ctl_rx_crypto_req(l1c, msg);
+ return l1ctl_rx_crypto_req(trxcon, msg);
/* Not (yet) handled messages */
case L1CTL_NEIGH_PM_REQ:
@@ -801,13 +800,13 @@
case L1CTL_TBF_CFG_REQ:
case L1CTL_DM_FREQ_REQ:
case L1CTL_SIM_REQ:
- LOGPFSMSL(fi, DL1C, LOGL_NOTICE,
+ LOGPFSMSL(trxcon->fi, DL1C, LOGL_NOTICE,
"Ignoring unsupported message (type=%u)\n",
l1h->msg_type);
msgb_free(msg);
return -ENOTSUP;
default:
- LOGPFSMSL(fi, DL1C, LOGL_ERROR, "Unknown MSG type %u: %s\n",
+ LOGPFSMSL(trxcon->fi, DL1C, LOGL_ERROR, "Unknown MSG type %u: %s\n",
l1h->msg_type, osmo_hexdump(msgb_data(msg), msgb_length(msg)));
msgb_free(msg);
return -EINVAL;
diff --git a/src/host/trxcon/src/trxcon_fsm.c b/src/host/trxcon/src/trxcon_fsm.c
index 0919315..28a4ecb 100644
--- a/src/host/trxcon/src/trxcon_fsm.c
+++ b/src/host/trxcon/src/trxcon_fsm.c
@@ -114,7 +114,7 @@
switch (fi->state) {
case TRXCON_ST_FBSB_SEARCH:
- l1ctl_tx_fbsb_fail(trxcon->l2if, trxcon->l1p.band_arfcn);
+ l1ctl_tx_fbsb_fail(trxcon, trxcon->l1p.band_arfcn);
osmo_fsm_inst_state_chg(fi, TRXCON_ST_RESET, 0, 0);
return 0;
default:
@@ -233,12 +233,12 @@
}
if (res->band_arfcn < req->band_arfcn_stop) {
- l1ctl_tx_pm_conf(trxcon->l2if, res->band_arfcn, res->dbm, false);
+ l1ctl_tx_pm_conf(trxcon, res->band_arfcn, res->dbm, false);
/* trxcon_st_full_power_scan_onenter() sends the next PHYIF_CMDT_MEASURE */
req->band_arfcn_start = res->band_arfcn + 1;
osmo_fsm_inst_state_chg(fi, TRXCON_ST_FULL_POWER_SCAN, 0, 0); /* TODO: timeout */
} else {
- l1ctl_tx_pm_conf(trxcon->l2if, res->band_arfcn, res->dbm, true);
+ l1ctl_tx_pm_conf(trxcon, res->band_arfcn, res->dbm, true);
LOGPFSML(fi, LOGL_INFO, "Full power scan completed\n");
TALLOC_FREE(trxcon->fi_data);
}
@@ -260,9 +260,7 @@
switch (event) {
case TRXCON_EV_FBSB_SEARCH_RES:
osmo_fsm_inst_state_chg(fi, TRXCON_ST_BCCH_CCCH, 0, 0);
- l1ctl_tx_fbsb_conf(trxcon->l2if,
- trxcon->l1p.band_arfcn,
- trxcon->sched->bsic);
+ l1ctl_tx_fbsb_conf(trxcon, trxcon->l1p.band_arfcn, trxcon->sched->bsic);
break;
default:
OSMO_ASSERT(0);
@@ -302,7 +300,7 @@
handle_tx_access_burst_req(fi, data);
break;
case TRXCON_EV_TX_ACCESS_BURST_CNF:
- l1ctl_tx_rach_conf(trxcon->l2if, (const struct trxcon_param_tx_access_burst_cnf *)data);
+ l1ctl_tx_rach_conf(trxcon, (const struct trxcon_param_tx_access_burst_cnf *)data);
break;
case TRXCON_EV_SET_CCCH_MODE_REQ:
{
@@ -388,7 +386,7 @@
break;
}
case TRXCON_EV_RX_DATA_IND:
- l1ctl_tx_dt_ind(trxcon->l2if, (const struct trxcon_param_rx_data_ind *)data);
+ l1ctl_tx_dt_ind(trxcon, (const struct trxcon_param_rx_data_ind *)data);
break;
default:
OSMO_ASSERT(0);
@@ -405,7 +403,7 @@
handle_tx_access_burst_req(fi, data);
break;
case TRXCON_EV_TX_ACCESS_BURST_CNF:
- l1ctl_tx_rach_conf(trxcon->l2if, (const struct trxcon_param_tx_access_burst_cnf *)data);
+ l1ctl_tx_rach_conf(trxcon, (const struct trxcon_param_tx_access_burst_cnf *)data);
break;
case TRXCON_EV_DEDICATED_RELEASE_REQ:
l1sched_reset(trxcon->sched, false);
@@ -495,10 +493,10 @@
break;
}
case TRXCON_EV_TX_DATA_CNF:
- l1ctl_tx_dt_conf(trxcon->l2if, (const struct trxcon_param_tx_data_cnf *)data);
+ l1ctl_tx_dt_conf(trxcon, (const struct trxcon_param_tx_data_cnf *)data);
break;
case TRXCON_EV_RX_DATA_IND:
- l1ctl_tx_dt_ind(trxcon->l2if, (const struct trxcon_param_rx_data_ind *)data);
+ l1ctl_tx_dt_ind(trxcon, (const struct trxcon_param_rx_data_ind *)data);
break;
default:
OSMO_ASSERT(0);
@@ -515,7 +513,7 @@
handle_tx_access_burst_req(fi, data);
break;
case TRXCON_EV_TX_ACCESS_BURST_CNF:
- l1ctl_tx_rach_conf(trxcon->l2if, (const struct trxcon_param_tx_access_burst_cnf *)data);
+ l1ctl_tx_rach_conf(trxcon, (const struct trxcon_param_tx_access_burst_cnf *)data);
break;
case TRXCON_EV_RX_DATA_IND:
{
@@ -548,13 +546,8 @@
if (trxcon->sched != NULL)
l1sched_free(trxcon->sched);
/* Close active connections */
- if (trxcon->l2if != NULL) {
- /* Avoid use-after-free: both *fi and *trxcon are children of
- * the L2IF (L1CTL connection), so we need to re-parent *fi
- * to NULL before calling l1ctl_client_conn_close(). */
- talloc_steal(NULL, fi);
- l1ctl_client_conn_close(trxcon->l2if);
- }
+ if (trxcon->l2if != NULL)
+ trxcon_l1ctl_close(trxcon);
if (trxcon->phyif != NULL)
phyif_close(trxcon->phyif);
diff --git a/src/host/trxcon/src/trxcon_main.c b/src/host/trxcon/src/trxcon_main.c
index 6b0e1fb..1ed2f89 100644
--- a/src/host/trxcon/src/trxcon_main.c
+++ b/src/host/trxcon/src/trxcon_main.c
@@ -336,6 +336,29 @@
return rc;
}
+void trxcon_l1ctl_close(struct trxcon_inst *trxcon)
+{
+ /* Avoid use-after-free: both *fi and *trxcon are children of
+ * the L2IF (L1CTL connection), so we need to re-parent *fi
+ * to NULL before calling l1ctl_client_conn_close(). */
+ talloc_steal(NULL, trxcon->fi);
+ l1ctl_client_conn_close(trxcon->l2if);
+}
+
+int trxcon_l1ctl_send(struct trxcon_inst *trxcon, struct msgb *msg)
+{
+ struct l1ctl_client *l1c = trxcon->l2if;
+
+ return l1ctl_client_send(l1c, msg);
+}
+
+static int l1ctl_rx_cb(struct l1ctl_client *l1c, struct msgb *msg)
+{
+ struct trxcon_inst *trxcon = l1c->priv;
+
+ return trxcon_l1ctl_receive(trxcon, msg);
+}
+
static void l1ctl_conn_accept_cb(struct l1ctl_client *l1c)
{
struct trxcon_inst *trxcon;
@@ -347,7 +370,7 @@
}
l1c->log_prefix = talloc_strdup(l1c, trxcon->log_prefix);
- l1c->priv = trxcon->fi;
+ l1c->priv = trxcon;
trxcon->l2if = l1c;
const struct trx_if_params phyif_params = {
@@ -372,12 +395,12 @@
static void l1ctl_conn_close_cb(struct l1ctl_client *l1c)
{
- struct osmo_fsm_inst *fi = l1c->priv;
+ struct trxcon_inst *trxcon = l1c->priv;
- if (fi == NULL)
+ if (trxcon == NULL || trxcon->fi == NULL)
return;
- osmo_fsm_inst_dispatch(fi, TRXCON_EV_L2IF_FAILURE, NULL);
+ osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_L2IF_FAILURE, NULL);
}
static void print_usage(const char *app)
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/30100
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I8d80af240b0e57f76263907c552288d4184876c0
Gerrit-Change-Number: 30100
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange
1
0