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

host/trxcon: handle L1CTL_RESET_REQ inside l1ctl.c

Change-Id: Ie5930dec800885784fb38ce6188c9c969cd2ad4e
---
M src/host/trxcon/l1ctl.c
M src/host/trxcon/trxcon.c
M src/host/trxcon/trxcon.h
3 files changed, 20 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/00/6700/1

diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index 4abec77..c01d372 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -245,8 +245,24 @@
 
        LOGP(DL1C, LOGL_DEBUG, "Recv Reset Req (%u)\n", res->type);
 
-       osmo_fsm_inst_dispatch(trxcon_fsm,
-               L1CTL_EVENT_RESET_REQ, res);
+       switch (res->type) {
+       case L1CTL_RES_T_FULL:
+               /* TODO: implement trx_if_reset() */
+               trx_if_flush_ctrl(l1l->trx);
+               trx_if_cmd_poweroff(l1l->trx);
+               trx_if_cmd_echo(l1l->trx);
+
+               /* Fall through */
+       case L1CTL_RES_T_SCHED:
+               sched_trx_reset(l1l->trx);
+               break;
+       default:
+               LOGP(DL1C, LOGL_ERROR, "Unknown L1CTL_RESET_REQ type\n");
+               goto exit;
+       }
+
+       /* Confirm */
+       rc = l1ctl_tx_reset_conf(l1l, res->type);
 
 exit:
        msgb_free(msg);
diff --git a/src/host/trxcon/trxcon.c b/src/host/trxcon/trxcon.c
index 9bc98e5..a87626f 100644
--- a/src/host/trxcon/trxcon.c
+++ b/src/host/trxcon/trxcon.c
@@ -89,18 +89,10 @@
                osmo_fsm_inst_state_chg(trxcon_fsm, TRXCON_STATE_IDLE, 0, 0);
 
                if (app_data.trx->fsm->state != TRX_STATE_OFFLINE) {
+                       /* TODO: implement trx_if_reset() */
                        trx_if_flush_ctrl(app_data.trx);
                        trx_if_cmd_poweroff(app_data.trx);
                }
-               break;
-       case L1CTL_EVENT_RESET_REQ:
-               trx_if_cmd_poweroff(app_data.trx);
-               trx_if_cmd_echo(app_data.trx);
-               sched_trx_reset(app_data.trx);
-               break;
-       case TRX_EVENT_RESET_IND:
-               /* TODO: send proper reset type */
-               l1ctl_tx_reset_conf(app_data.l1l, L1CTL_RES_T_BOOT);
                break;
        case SCH_EVENT_DATA:
                l1ctl_tx_data_ind(app_data.l1l, (struct l1ctl_info_dl *) data);
@@ -108,6 +100,7 @@
        case TRX_EVENT_OFFLINE:
        case SCH_EVENT_CLCK_IND:
        case SCH_EVENT_CLCK_LOSS:
+       case TRX_EVENT_RESET_IND:
                /* TODO: notify L2 & L3 about that */
                break;
        default:
@@ -125,7 +118,6 @@
        [TRXCON_STATE_MANAGED] = {
                .in_event_mask = (
                        GEN_MASK(L1CTL_EVENT_DISCONNECT) |
-                       GEN_MASK(L1CTL_EVENT_RESET_REQ) |
                        GEN_MASK(TRX_EVENT_RESET_IND) |
                        GEN_MASK(TRX_EVENT_RSP_ERROR) |
                        GEN_MASK(TRX_EVENT_OFFLINE) |
diff --git a/src/host/trxcon/trxcon.h b/src/host/trxcon/trxcon.h
index 7b3a232..6452f80 100644
--- a/src/host/trxcon/trxcon.h
+++ b/src/host/trxcon/trxcon.h
@@ -11,7 +11,6 @@
        /* L1CTL specific events */
        L1CTL_EVENT_CONNECT,
        L1CTL_EVENT_DISCONNECT,
-       L1CTL_EVENT_RESET_REQ,
 
        /* TRX specific events */
        TRX_EVENT_RESET_IND,

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

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

Reply via email to