fixeria has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmocom-bb/+/29958 )
Change subject: trxcon: handle DATA.cnf/TRAFFIC.cnf via TRXCON_EV_TX_DATA_CNF
......................................................................
trxcon: handle DATA.cnf/TRAFFIC.cnf via TRXCON_EV_TX_DATA_CNF
We already handle DATA.req/TRAFFIC.req via TRXCON_EV_TX_DATA_REQ,
so let's handle the respective *.cnf messages via the FSM too.
Change-Id: Ica7a25f0bf8c7f89037a776d711ac641c57c9ad5
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.c
M src/host/trxcon/src/trxcon_fsm.c
5 files changed, 33 insertions(+), 14 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/58/29958/1
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
index 0d55ff1..eb67bee 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
@@ -20,6 +20,6 @@
int l1ctl_tx_dt_ind(struct l1ctl_client *l1c,
const struct trxcon_param_rx_data_ind *ind);
int l1ctl_tx_dt_conf(struct l1ctl_client *l1c,
- struct l1ctl_info_dl *data, bool traffic);
+ const struct trxcon_param_tx_data_cnf *cnf);
int l1ctl_tx_rach_conf(struct l1ctl_client *l1c,
uint16_t band_arfcn, uint32_t fn);
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
index 9c641df..5af2122 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
@@ -30,6 +30,7 @@
TRXCON_EV_DEDICATED_ESTABLISH_REQ,
TRXCON_EV_DEDICATED_RELEASE_REQ,
TRXCON_EV_TX_DATA_REQ,
+ TRXCON_EV_TX_DATA_CNF,
TRXCON_EV_RX_DATA_IND,
TRXCON_EV_CRYPTO_REQ,
};
@@ -91,6 +92,15 @@
const uint8_t *data;
};
+/* param of TRXCON_EV_TX_DATA_CNF */
+struct trxcon_param_tx_data_cnf {
+ bool traffic;
+ uint8_t chan_nr;
+ uint8_t link_id;
+ uint16_t band_arfcn;
+ uint32_t frame_nr;
+};
+
/* param of TRXCON_EV_RX_DATA_IND */
struct trxcon_param_rx_data_ind {
bool traffic;
diff --git a/src/host/trxcon/src/l1ctl.c b/src/host/trxcon/src/l1ctl.c
index 7a35d59..b9805eb 100644
--- a/src/host/trxcon/src/l1ctl.c
+++ b/src/host/trxcon/src/l1ctl.c
@@ -285,8 +285,8 @@
/**
* Handles both L1CTL_DATA_CONF and L1CTL_TRAFFIC_CONF.
*/
-int l1ctl_tx_dt_conf(struct l1ctl_client *l1c,
- struct l1ctl_info_dl *data, bool traffic)
+int l1ctl_tx_dt_conf(struct l1ctl_client *l1c, bool traffic,
+ struct trxcon_param_tx_data_cnf *cnf)
{
struct msgb *msg;
@@ -295,8 +295,15 @@
if (msg == NULL)
return -ENOMEM;
+ const struct l1ctl_info_dl dl_hdr = {
+ .chan_nr = cnf->chan_nr,
+ .link_id = cnf->link_id,
+ .frame_nr = htonl(cnf->frame_nr),
+ .band_arfcn = htons(cnf->band_arfcn),
+ };
+
/* Copy DL frame header from source message */
- put_dl_info_hdr(msg, data);
+ put_dl_info_hdr(msg, &dl_hdr);
return l1ctl_client_send(l1c, msg);
}
diff --git a/src/host/trxcon/src/trxcon.c b/src/host/trxcon/src/trxcon.c
index 039195b..6b5bdb5 100644
--- a/src/host/trxcon/src/trxcon.c
+++ b/src/host/trxcon/src/trxcon.c
@@ -47,7 +47,6 @@
#include <osmocom/bb/trxcon/logging.h>
#include <osmocom/bb/trxcon/l1ctl.h>
#include <osmocom/bb/trxcon/l1ctl_server.h>
-#include <osmocom/bb/trxcon/l1ctl_proto.h>
#include <osmocom/bb/l1sched/l1sched.h>
#define COPYRIGHT \
@@ -248,7 +247,6 @@
const struct l1sched_lchan_desc *lchan_desc;
struct l1sched_state *sched = lchan->ts->sched;
struct trxcon_inst *trxcon = sched->priv;
- struct l1ctl_info_dl dl_hdr;
const uint8_t *data;
uint8_t ra_buf[2];
size_t data_len;
@@ -256,22 +254,21 @@
lchan_desc = &l1sched_lchan_desc[lchan->type];
- dl_hdr = (struct l1ctl_info_dl) {
+ struct trxcon_param_tx_data_cnf cnf = {
+ /* .traffic is set below */
.chan_nr = lchan_desc->chan_nr | lchan->ts->index,
.link_id = lchan_desc->link_id,
- .frame_nr = htonl(fn),
- .band_arfcn = htons(trxcon->l1p.band_arfcn),
+ .band_arfcn = trxcon->l1p.band_arfcn,
+ .frame_nr = fn,
};
switch (dt) {
case L1SCHED_DT_TRAFFIC:
case L1SCHED_DT_PACKET_DATA:
- rc = l1ctl_tx_dt_conf(trxcon->l2if, &dl_hdr, true);
- data_len = lchan->prim->payload_len;
- data = lchan->prim->payload;
- break;
+ cnf.traffic = true;
+ /* fall-through */
case L1SCHED_DT_SIGNALING:
- rc = l1ctl_tx_dt_conf(trxcon->l2if, &dl_hdr, false);
+ rc = osmo_fsm_inst_dispatch(trxcon->fi, TRXCON_EV_TX_DATA_CNF, &cnf);
data_len = lchan->prim->payload_len;
data = lchan->prim->payload;
break;
diff --git a/src/host/trxcon/src/trxcon_fsm.c b/src/host/trxcon/src/trxcon_fsm.c
index fb375c4..676c060 100644
--- a/src/host/trxcon/src/trxcon_fsm.c
+++ b/src/host/trxcon/src/trxcon_fsm.c
@@ -443,6 +443,9 @@
}
break;
}
+ case TRXCON_EV_TX_DATA_CNF:
+ l1ctl_tx_dt_conf(trxcon->l2if, (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);
break;
@@ -549,6 +552,7 @@
| S(TRXCON_EV_TX_ACCESS_BURST_REQ)
| S(TRXCON_EV_SET_TCH_MODE_REQ)
| S(TRXCON_EV_TX_DATA_REQ)
+ | S(TRXCON_EV_TX_DATA_CNF)
| S(TRXCON_EV_RX_DATA_IND)
| S(TRXCON_EV_CRYPTO_REQ),
.action = &trxcon_st_dedicated_action,
@@ -582,6 +586,7 @@
OSMO_VALUE_STRING(TRXCON_EV_DEDICATED_ESTABLISH_REQ),
OSMO_VALUE_STRING(TRXCON_EV_DEDICATED_RELEASE_REQ),
OSMO_VALUE_STRING(TRXCON_EV_TX_DATA_REQ),
+ OSMO_VALUE_STRING(TRXCON_EV_TX_DATA_CNF),
OSMO_VALUE_STRING(TRXCON_EV_RX_DATA_IND),
OSMO_VALUE_STRING(TRXCON_EV_CRYPTO_REQ),
{ 0, NULL }
--
To view, visit
https://gerrit.osmocom.org/c/osmocom-bb/+/29958
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Ica7a25f0bf8c7f89037a776d711ac641c57c9ad5
Gerrit-Change-Number: 29958
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange