Review at  https://gerrit.osmocom.org/6762

host/trxcon/l1ctl.c: make l1ctl_tx_data_ind flexible

Now this function can send both DATA and TRAFFIC indications.

Change-Id: I945c10c317155917b6e6ce9d663d9cb46f2e085c
---
M src/host/trxcon/l1ctl.c
M src/host/trxcon/l1ctl.h
M src/host/trxcon/sched_lchan_xcch.c
3 files changed, 14 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/62/6762/1

diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index ed30205..ee03ad6 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -177,18 +177,25 @@
        return l1ctl_link_send(l1l, msg);
 }
 
-int l1ctl_tx_data_ind(struct l1ctl_link *l1l, struct l1ctl_info_dl *data)
+int l1ctl_tx_data_ind(struct l1ctl_link *l1l,
+       struct l1ctl_info_dl *data, uint8_t msg_type)
 {
        struct l1ctl_info_dl *dl;
        struct msgb *msg;
        size_t len;
 
-       msg = l1ctl_alloc_msg(L1CTL_DATA_IND);
+       if (msg_type != L1CTL_DATA_IND && msg_type != L1CTL_TRAFFIC_IND) {
+               LOGP(DL1C, LOGL_DEBUG, "Incorrect indication type\n");
+               return -EINVAL;
+       }
+
+       msg = l1ctl_alloc_msg(msg_type);
        if (msg == NULL)
                return -ENOMEM;
 
-       /* We store the 23-byte payload as a flexible array member */
-       len = sizeof(struct l1ctl_info_dl) + 23;
+       /* We store the payload as a flexible array member */
+       len = sizeof(struct l1ctl_info_dl);
+       len += msg_type == L1CTL_DATA_IND ? 23 : TRAFFIC_DATA_LEN;
        dl = (struct l1ctl_info_dl *) msgb_put(msg, len);
 
        /* Copy header and data from source message */
diff --git a/src/host/trxcon/l1ctl.h b/src/host/trxcon/l1ctl.h
index e83138d..4f48aaa 100644
--- a/src/host/trxcon/l1ctl.h
+++ b/src/host/trxcon/l1ctl.h
@@ -18,6 +18,7 @@
 int l1ctl_tx_reset_conf(struct l1ctl_link *l1l, uint8_t type);
 int l1ctl_tx_reset_ind(struct l1ctl_link *l1l, uint8_t type);
 
-int l1ctl_tx_data_ind(struct l1ctl_link *l1l, struct l1ctl_info_dl *ind);
+int l1ctl_tx_data_ind(struct l1ctl_link *l1l,
+       struct l1ctl_info_dl *data, uint8_t msg_type);
 int l1ctl_tx_rach_conf(struct l1ctl_link *l1l, uint32_t fn);
 int l1ctl_tx_data_conf(struct l1ctl_link *l1l);
diff --git a/src/host/trxcon/sched_lchan_xcch.c 
b/src/host/trxcon/sched_lchan_xcch.c
index 1ea7468..9a7a09b 100644
--- a/src/host/trxcon/sched_lchan_xcch.c
+++ b/src/host/trxcon/sched_lchan_xcch.c
@@ -181,7 +181,7 @@
        memcpy(data->payload, l2, 23);
 
        /* Put a packet to higher layers */
-       l1ctl_tx_data_ind(trx->l1l, data);
+       l1ctl_tx_data_ind(trx->l1l, data, L1CTL_DATA_IND);
        talloc_free(data);
 
        /* TODO: AGC, TA loops */

-- 
To view, visit https://gerrit.osmocom.org/6762
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I945c10c317155917b6e6ce9d663d9cb46f2e085c
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>

Reply via email to