jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/34478?usp=email )
Change subject: ASCI: MM connections are defined by 'ref' and 'protocol' tuple ......................................................................
ASCI: MM connections are defined by 'ref' and 'protocol' tuple
VGCS and VBS calls may share the same (call) ref or share with other protocols. Therefore the MM connection is defined by the reference and the prococol discriminator.
Related: OS#5364 Change-Id: Ic280cd8c666660077bb2c2ef641f4cddd3b36eee --- M src/host/layer23/include/osmocom/bb/mobile/gsm48_mm.h M src/host/layer23/src/mobile/gsm48_mm.c 2 files changed, 47 insertions(+), 11 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/78/34478/1
diff --git a/src/host/layer23/include/osmocom/bb/mobile/gsm48_mm.h b/src/host/layer23/include/osmocom/bb/mobile/gsm48_mm.h index bdf5716..3ece82e 100644 --- a/src/host/layer23/include/osmocom/bb/mobile/gsm48_mm.h +++ b/src/host/layer23/include/osmocom/bb/mobile/gsm48_mm.h @@ -231,7 +231,7 @@ struct llist_head list; struct gsm48_mmlayer *mm;
- /* ref and type form a unique tuple */ + /* ref and protocol form a unique tuple */ uint32_t ref; /* reference to trans */ uint8_t protocol; uint8_t transaction_id; diff --git a/src/host/layer23/src/mobile/gsm48_mm.c b/src/host/layer23/src/mobile/gsm48_mm.c index fe7115e..70a35f8 100644 --- a/src/host/layer23/src/mobile/gsm48_mm.c +++ b/src/host/layer23/src/mobile/gsm48_mm.c @@ -1403,7 +1403,7 @@ /* new MM connection state */ static void new_conn_state(struct gsm48_mm_conn *conn, int state) { - LOGP(DMM, LOGL_INFO, "(ref %x) new state %s -> %s\n", conn->ref, + LOGP(DMM, LOGL_INFO, "(ref 0x%x proto %d) new state %s -> %s\n", conn->ref, conn->protocol gsm48_mmxx_state_names[conn->state], gsm48_mmxx_state_names[state]); conn->state = state; @@ -1424,13 +1424,35 @@ }
/* find MM connection by reference */ -struct gsm48_mm_conn *mm_conn_by_ref(struct gsm48_mmlayer *mm, - uint32_t ref) +struct gsm48_mm_conn *mm_conn_by_ref_and_class(struct gsm48_mmlayer *mm, + uint32_t ref, uint16_t class) { struct gsm48_mm_conn *conn; + uint8_t protocol; + + switch (class) { + case GSM48_MMCC_CLASS: + protocol = GSM48_PDISC_CC; + break; + case GSM48_MMSS_CLASS: + protocol = GSM48_PDISC_NC_SS; + break; + case GSM48_MMSMS_CLASS: + protocol = GSM48_PDISC_SMS; + break; + case GSM48_MMGCC_CLASS: + protocol = GSM48_PDISC_GROUP_CC; + break; + case GSM48_MMBCC_CLASS: + protocol = GSM48_PDISC_BCAST_CC; + break; + default: + LOGP(DMM, LOGL_ERROR, "Invalid message class 0x%x. Please fix!", class); + return NULL; + }
llist_for_each_entry(conn, &mm->mm_conn, list) { - if (conn->ref == ref) + if (conn->ref == ref && conn->protocol == protocol) return conn; } return NULL; @@ -3428,7 +3450,7 @@ int msg_type = mmh->msg_type;
/* get connection, if not exist (anymore), release */ - conn = mm_conn_by_ref(mm, mmh->ref); + conn = mm_conn_by_ref_and_class(mm, mmh->ref, (mmh->msg_type & GSM48_MMXX_MASK)); if (!conn) { LOGP(DMM, LOGL_INFO, "MMXX_DATA_REQ with unknown (already " "released) ref=%x, sending MMXX_REL_IND\n", mmh->ref); @@ -3457,7 +3479,7 @@ struct gsm48_mm_conn *conn;
/* get connection, if not exist (anymore), release */ - conn = mm_conn_by_ref(mm, mmh->ref); + conn = mm_conn_by_ref_and_class(mm, mmh->ref, (mmh->msg_type & GSM48_MMXX_MASK)); if (conn) mm_conn_free(conn);
@@ -3481,7 +3503,7 @@ struct gsm48_mm_conn *conn;
/* get connection, if not exist (anymore), release */ - conn = mm_conn_by_ref(mm, mmh->ref); + conn = mm_conn_by_ref_and_class(mm, mmh->ref, (mmh->msg_type & GSM48_MMXX_MASK)); if (conn) mm_conn_free(conn);
@@ -3496,7 +3518,7 @@ struct gsm48_mm_conn *conn;
/* get connection, if not exist (anymore), release */ - conn = mm_conn_by_ref(mm, mmh->ref); + conn = mm_conn_by_ref_and_class(mm, mmh->ref, (mmh->msg_type & GSM48_MMXX_MASK)); if (conn) mm_conn_free(conn);
@@ -3525,7 +3547,7 @@ struct gsm48_mm_conn *conn;
/* get connection, if not exist (anymore), release */ - conn = mm_conn_by_ref(mm, mmh->ref); + conn = mm_conn_by_ref_and_class(mm, mmh->ref, (mmh->msg_type & GSM48_MMXX_MASK)); if (conn) mm_conn_free(conn);
@@ -3820,7 +3842,7 @@ int i, rc;
/* keep up to date with the transaction ID */ - conn = mm_conn_by_ref(mm, mmh->ref); + conn = mm_conn_by_ref_and_class(mm, mmh->ref, (mmh->msg_type & GSM48_MMXX_MASK)); if (conn) conn->transaction_id = mmh->transaction_id;