fixeria has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmocom-bb/+/29956 )
Change subject: trxcon: compose struct l1ctl_info_dl in l1ctl_tx_dt_ind()
......................................................................
trxcon: compose struct l1ctl_info_dl in l1ctl_tx_dt_ind()
The trxcon_fsm should not be dealing with the L1CTL protocol, so
let's better hand over the trxcon_param_rx_traffic_data_ind to
l1ctl_tx_dt_ind() and compose the l1ctl_info_dl there.
Change-Id: Ie57d86ffd9ea7c44187aafba0df1f519d1c523fb
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, 22 insertions(+), 41 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/56/29956/1
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
index 9518bb9..70d804f 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/l1ctl.h
@@ -17,10 +17,8 @@
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,
- const struct l1ctl_info_dl *dl_info,
- const uint8_t *l2, size_t l2_len,
- bool traffic);
+int l1ctl_tx_dt_ind(struct l1ctl_client *l1c, bool traffic,
+ const struct trxcon_param_rx_traffic_data_ind *ind);
int l1ctl_tx_dt_conf(struct l1ctl_client *l1c,
struct l1ctl_info_dl *data, bool traffic);
int l1ctl_tx_rach_conf(struct l1ctl_client *l1c,
diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
index 9aa5e55..37e3f14 100644
--- a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
+++ b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h
@@ -96,6 +96,7 @@
struct trxcon_param_rx_traffic_data_ind {
uint8_t chan_nr;
uint8_t link_id;
+ uint16_t band_arfcn;
uint32_t frame_nr;
int16_t toa256;
int8_t rssi;
diff --git a/src/host/trxcon/src/l1ctl.c b/src/host/trxcon/src/l1ctl.c
index 87bfe74..5baac1f 100644
--- a/src/host/trxcon/src/l1ctl.c
+++ b/src/host/trxcon/src/l1ctl.c
@@ -232,26 +232,32 @@
/**
* Handles both L1CTL_DATA_IND and L1CTL_TRAFFIC_IND.
*/
-int l1ctl_tx_dt_ind(struct l1ctl_client *l1c,
- const struct l1ctl_info_dl *dl_info,
- const uint8_t *l2, size_t l2_len,
- bool traffic)
+int l1ctl_tx_dt_ind(struct l1ctl_client *l1c, bool traffic,
+ const struct trxcon_param_rx_traffic_data_ind *ind)
{
struct msgb *msg;
- uint8_t *msg_l2;
msg = l1ctl_alloc_msg(traffic ?
L1CTL_TRAFFIC_IND : L1CTL_DATA_IND);
if (msg == NULL)
return -ENOMEM;
- put_dl_info_hdr(msg, dl_info);
+ const struct l1ctl_info_dl dl_hdr = {
+ .chan_nr = ind->chan_nr,
+ .link_id = ind->link_id,
+ .frame_nr = htonl(ind->frame_nr),
+ .band_arfcn = htons(ind->band_arfcn),
+ .fire_crc = ind->data_len > 0 ? 0 : 2,
+ .rx_level = dbm2rxlev(ind->rssi),
+ .num_biterr = ind->n_errors,
+ /* TODO: set proper .snr */
+ };
+
+ put_dl_info_hdr(msg, &dl_hdr);
/* Copy the L2 payload if preset */
- if (l2 && l2_len > 0) {
- msg_l2 = (uint8_t *) msgb_put(msg, l2_len);
- memcpy(msg_l2, l2, l2_len);
- }
+ if (ind->data && ind->data_len > 0)
+ memcpy(msgb_put(msg, ind->data_len), ind->data, ind->data_len);
/* Put message to upper layers */
return l1ctl_client_send(l1c, msg);
diff --git a/src/host/trxcon/src/trxcon.c b/src/host/trxcon/src/trxcon.c
index 764f717..0bbb602 100644
--- a/src/host/trxcon/src/trxcon.c
+++ b/src/host/trxcon/src/trxcon.c
@@ -200,6 +200,7 @@
struct trxcon_param_rx_traffic_data_ind ind = {
.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,
diff --git a/src/host/trxcon/src/trxcon_fsm.c b/src/host/trxcon/src/trxcon_fsm.c
index 58a749e..0e005a3 100644
--- a/src/host/trxcon/src/trxcon_fsm.c
+++ b/src/host/trxcon/src/trxcon_fsm.c
@@ -23,8 +23,6 @@
#include <string.h>
#include <errno.h>
-#include <arpa/inet.h>
-
#include <osmocom/core/fsm.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
@@ -34,7 +32,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>
#include <osmocom/bb/l1sched/logging.h>
@@ -345,18 +342,8 @@
case TRXCON_EV_RX_DATA_IND:
{
const struct trxcon_param_rx_traffic_data_ind *ind = data;
- const struct l1ctl_info_dl dl_hdr = {
- .chan_nr = ind->chan_nr,
- .link_id = ind->link_id,
- .frame_nr = htonl(ind->frame_nr),
- .band_arfcn = htons(trxcon->l1p.band_arfcn),
- .fire_crc = ind->data_len > 0 ? 0 : 2,
- .rx_level = dbm2rxlev(ind->rssi),
- .num_biterr = ind->n_errors,
- /* TODO: set proper .snr */
- };
- l1ctl_tx_dt_ind(trxcon->l2if, &dl_hdr, ind->data, ind->data_len, false);
+ l1ctl_tx_dt_ind(trxcon->l2if, false, ind);
break;
}
default:
@@ -465,20 +452,8 @@
case TRXCON_EV_RX_DATA_IND:
{
const struct trxcon_param_rx_traffic_data_ind *ind = data;
- const struct l1ctl_info_dl dl_hdr = {
- .chan_nr = ind->chan_nr,
- .link_id = ind->link_id,
- .frame_nr = htonl(ind->frame_nr),
- .band_arfcn = htons(trxcon->l1p.band_arfcn),
- .fire_crc = ind->data_len > 0 ? 0 : 2,
- .rx_level = dbm2rxlev(ind->rssi),
- .num_biterr = ind->n_errors,
- /* TODO: set proper .snr */
- };
- l1ctl_tx_dt_ind(trxcon->l2if, &dl_hdr,
- ind->data, ind->data_len,
- event == TRXCON_EV_RX_TRAFFIC_IND);
+ l1ctl_tx_dt_ind(trxcon->l2if, event == TRXCON_EV_RX_TRAFFIC_IND, ind);
break;
}
default:
--
To view, visit
https://gerrit.osmocom.org/c/osmocom-bb/+/29956
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Ie57d86ffd9ea7c44187aafba0df1f519d1c523fb
Gerrit-Change-Number: 29956
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange