fixeria has submitted this change. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/35577?usp=email )

Change subject: mobile: add generic signals for CC/SS/SM transactions
......................................................................

mobile: add generic signals for CC/SS/SM transactions

This allows driving logic in other modules based on transaction
related events, such as allocation, deallocation, or a state change.
These new signals will be used in the upcoming CSD implementation.

Change-Id: Idae5da24cb517878a26cc14b2ba6976e60f0b31b
Related: OS#4396
---
M src/host/layer23/include/osmocom/bb/common/osmocom_data.h
M src/host/layer23/src/mobile/gsm480_ss.c
M src/host/layer23/src/mobile/gsm48_cc.c
M src/host/layer23/src/mobile/transaction.c
4 files changed, 46 insertions(+), 10 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved




diff --git a/src/host/layer23/include/osmocom/bb/common/osmocom_data.h 
b/src/host/layer23/include/osmocom/bb/common/osmocom_data.h
index 3a8cd2a..935c02b 100644
--- a/src/host/layer23/include/osmocom/bb/common/osmocom_data.h
+++ b/src/host/layer23/include/osmocom/bb/common/osmocom_data.h
@@ -11,6 +11,7 @@
        SS_GLOBAL,
        SS_L23_VTY,
        SS_L23_SUBSCR,
+       SS_L23_TRANS,
 };

 enum osmobb_l1ctl_sig {
@@ -40,6 +41,12 @@
        S_L23_SUBSCR_SIM_AUTH_RESP,
 };

+enum osmobb_l23_trans_sig {
+       S_L23_CC_TRANS_ALLOC,           /* new transaction has been allocated */
+       S_L23_CC_TRANS_FREE,            /* transaction is about to be free()d */
+       S_L23_CC_TRANS_STATE_CHG,       /* transaction state has been changed */
+};
+
 struct osmobb_l23_vty_sig_data {
        struct vty *vty;
        union {
diff --git a/src/host/layer23/src/mobile/gsm480_ss.c 
b/src/host/layer23/src/mobile/gsm480_ss.c
index fe601bc..0acd18d 100644
--- a/src/host/layer23/src/mobile/gsm480_ss.c
+++ b/src/host/layer23/src/mobile/gsm480_ss.c
@@ -22,6 +22,12 @@
 #include <stdlib.h>

 #include <osmocom/core/msgb.h>
+#include <osmocom/core/signal.h>
+#include <osmocom/core/talloc.h>
+
+#include <osmocom/gsm/protocol/gsm_04_80.h>
+#include <osmocom/gsm/gsm48.h>
+
 #include <osmocom/bb/common/logging.h>
 #include <osmocom/bb/common/osmocom_data.h>
 #include <osmocom/bb/common/ms.h>
@@ -29,10 +35,7 @@
 #include <osmocom/bb/mobile/transaction.h>
 #include <osmocom/bb/mobile/gsm480_ss.h>
 #include <osmocom/bb/mobile/gsm44068_gcc_bcc.h>
-#include <osmocom/core/talloc.h>
 #include <osmocom/bb/mobile/vty.h>
-#include <osmocom/gsm/protocol/gsm_04_80.h>
-#include <osmocom/gsm/gsm48.h>

 static uint32_t new_callref = 0x80000001;

@@ -213,7 +216,7 @@
        return 0;
 }

-enum {
+enum gsm480_ss_state {
        GSM480_SS_ST_IDLE = 0,
        GSM480_SS_ST_REGISTER,
        GSM480_SS_ST_ACTIVE,
@@ -284,6 +287,13 @@
        return 0;
 }

+static void gsm480_trans_state_chg(struct gsm_trans *trans,
+                                  enum gsm480_ss_state state)
+{
+       trans->ss.state = state;
+       osmo_signal_dispatch(SS_L23_TRANS, S_L23_CC_TRANS_STATE_CHG, trans);
+}
+
 /*
  * encoding
  */
@@ -624,8 +634,7 @@
                return -ENOMEM;
        }

-       /* go register sent state */
-       trans->ss.state = GSM480_SS_ST_REGISTER;
+       gsm480_trans_state_chg(trans, GSM480_SS_ST_REGISTER);

        /* FIXME: generate invoke ID */
        trans->ss.invoke_id = 5;
@@ -1107,8 +1116,7 @@
                return -EINVAL;
        }

-       /* go register state */
-       trans->ss.state = GSM480_SS_ST_ACTIVE;
+       gsm480_trans_state_chg(trans, GSM480_SS_ST_ACTIVE);

        if (TLVP_PRESENT(&tp, GSM48_IE_FACILITY)) {
                rc = gsm480_rx_fac_ie(trans, TLVP_VAL(&tp, GSM48_IE_FACILITY),
@@ -1143,8 +1151,7 @@
                return -EINVAL;
        }

-       /* go register state */
-       trans->ss.state = GSM480_SS_ST_ACTIVE;
+       gsm480_trans_state_chg(trans, GSM480_SS_ST_ACTIVE);

        if (TLVP_PRESENT(&tp, GSM48_IE_FACILITY)) {
                rc = gsm480_rx_fac_ie(trans, TLVP_VAL(&tp, GSM48_IE_FACILITY),
diff --git a/src/host/layer23/src/mobile/gsm48_cc.c 
b/src/host/layer23/src/mobile/gsm48_cc.c
index b49159d..9ed2971 100644
--- a/src/host/layer23/src/mobile/gsm48_cc.c
+++ b/src/host/layer23/src/mobile/gsm48_cc.c
@@ -25,6 +25,7 @@
 #include <osmocom/core/utils.h>
 #include <osmocom/gsm/gsm48.h>
 #include <osmocom/core/talloc.h>
+#include <osmocom/core/signal.h>

 #include <osmocom/bb/common/logging.h>
 #include <osmocom/bb/common/osmocom_data.h>
@@ -239,6 +240,8 @@
                gsm48_cc_state_name(state));

        trans->cc.state = state;
+
+       osmo_signal_dispatch(SS_L23_TRANS, S_L23_CC_TRANS_STATE_CHG, trans);
 }

 /*
diff --git a/src/host/layer23/src/mobile/transaction.c 
b/src/host/layer23/src/mobile/transaction.c
index 3cc25fd..570545b 100644
--- a/src/host/layer23/src/mobile/transaction.c
+++ b/src/host/layer23/src/mobile/transaction.c
@@ -17,6 +17,7 @@

 #include <stdint.h>

+#include <osmocom/core/signal.h>
 #include <osmocom/core/talloc.h>
 #include <osmocom/core/timer.h>
 #include <osmocom/core/msgb.h>
@@ -79,11 +80,15 @@

        llist_add_tail(&trans->entry, &ms->trans_list);

+       osmo_signal_dispatch(SS_L23_TRANS, S_L23_CC_TRANS_ALLOC, trans);
+
        return trans;
 }

 void trans_free(struct gsm_trans *trans)
 {
+       osmo_signal_dispatch(SS_L23_TRANS, S_L23_CC_TRANS_FREE, trans);
+
        switch (trans->protocol) {
        case GSM48_PDISC_CC:
                _gsm48_cc_trans_free(trans);

--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35577?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Idae5da24cb517878a26cc14b2ba6976e60f0b31b
Gerrit-Change-Number: 35577
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanits...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanits...@sysmocom.de>
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-CC: pespin <pes...@sysmocom.de>
Gerrit-MessageType: merged

Reply via email to