Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/5101

to look at the new patch set (#3).

mobile: Notify MM status changes and generate primitive op ind

Notify once the mm state has been changed. Unfortunaley one state
transition can immediately trigger more transitions (recursively).
In the mid-term it might be best to force all primitives to be
async to avoid unpredictable behavior (e.g. make a shutdown while
being a recursion down?)

Change-Id: I8e9dcf7fd9116985aa060ba027ba74107a19223a
---
M src/host/layer23/include/osmocom/bb/mobile/primitives.h
M src/host/layer23/src/mobile/gsm48_mm.c
M src/host/layer23/src/mobile/primitives.c
3 files changed, 24 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/01/5101/3

diff --git a/src/host/layer23/include/osmocom/bb/mobile/primitives.h 
b/src/host/layer23/include/osmocom/bb/mobile/primitives.h
index 6804fc0..39b4945 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/primitives.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/primitives.h
@@ -19,6 +19,7 @@
        PRIM_MOB_STARTED,
        PRIM_MOB_SHUTDOWN,
        PRIM_MOB_SMS,
+       PRIM_MOB_MM,
 };
 
 struct mobile_prim_intf {
@@ -65,6 +66,15 @@
        int cause;
 };
 
+/**
+ * Mobility Management (MM) state changes.
+ */
+struct mobile_mm_param {
+       int state;                      /*!< The new MM state */
+       int substate;                   /*!< The current substate */
+       int prev_substate;              /*!< The previous substate */
+};
+
 struct mobile_prim {
        struct osmo_prim_hdr hdr;       /*!< Primitive base class */
        union {
@@ -72,6 +82,7 @@
                struct mobile_started_param started;
                struct mobile_shutdown_param shutdown;
                struct mobile_sms_param sms;
+               struct mobile_mm_param mm;
        } u;
 };
 
@@ -86,3 +97,4 @@
 void mobile_prim_ntfy_shutdown(struct osmocom_ms *ms, int old_state, int 
new_state);
 void mobile_prim_ntfy_sms_new(struct osmocom_ms *ms, struct gsm_sms *sms);
 void mobile_prim_ntfy_sms_status(struct osmocom_ms *ms, struct gsm_sms *sms, 
uint8_t cause);
+void mobile_prim_ntfy_mm_status(struct osmocom_ms *ms, int state, int subs, 
int old_subs);
diff --git a/src/host/layer23/src/mobile/gsm48_mm.c 
b/src/host/layer23/src/mobile/gsm48_mm.c
index f32d57a..a7af1f5 100644
--- a/src/host/layer23/src/mobile/gsm48_mm.c
+++ b/src/host/layer23/src/mobile/gsm48_mm.c
@@ -39,6 +39,7 @@
 #include <osmocom/bb/mobile/gsm480_ss.h>
 #include <osmocom/bb/mobile/gsm411_sms.h>
 #include <osmocom/bb/mobile/app_mobile.h>
+#include <osmocom/bb/mobile/primitives.h>
 #include <osmocom/bb/mobile/vty.h>
 
 extern void *l23_ctx;
@@ -961,6 +962,7 @@
 
        mm->state = state;
        mm->substate = substate;
+       mobile_prim_ntfy_mm_status(ms, mm->state, mm->substate, 
mm->mr_substate);
 
        /* resend detach event, if flag is set */
        if (state == GSM48_MM_ST_MM_IDLE && mm->delay_detach) {
diff --git a/src/host/layer23/src/mobile/primitives.c 
b/src/host/layer23/src/mobile/primitives.c
index 0902139..fd486ea 100644
--- a/src/host/layer23/src/mobile/primitives.c
+++ b/src/host/layer23/src/mobile/primitives.c
@@ -144,6 +144,16 @@
        dispatch(ms, prim);
 }
 
+void mobile_prim_ntfy_mm_status(struct osmocom_ms *ms, int state, int 
substate, int mr_substate)
+{
+       struct mobile_prim *prim = mobile_prim_alloc(PRIM_MOB_MM, 
PRIM_OP_INDICATION);
+
+       prim->u.mm.state = state;
+       prim->u.mm.substate = substate;
+       prim->u.mm.prev_substate = mr_substate;
+       dispatch(ms, prim);
+}
+
 static int cancel_timer(struct mobile_prim_intf *intf, struct 
mobile_timer_param *param)
 {
        struct timer_closure *closure;

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8e9dcf7fd9116985aa060ba027ba74107a19223a
Gerrit-PatchSet: 3
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder

Reply via email to