Attention is currently required from: fixeria.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/28120 )
Change subject: coding: cosmetic: move 'dtx_prev' to the scope where it's used
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/28120
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I147f44f1c071e53febeff425a0a7837a0ff10436
Gerrit-Change-Number: 28120
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 16 May 2022 10:46:27 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/28115 )
Change subject: vlr: Split vlr_subscr_rx_imsi_detach()
......................................................................
vlr: Split vlr_subscr_rx_imsi_detach()
The function vlr_subscr_rx_imsi_detach() implies that an explicit IMSI
DETACH was received. However, that same function was called in other
situations such as timer expiration or GSUP CANCEL.
Let's clean this up by splitting the function into two parts.
No logical change is introduced to the VLR in this patch.
Change-Id: Iffc02f3062ad591ca372a3c6d866066cf63a8830
---
M src/libvlr/vlr.c
1 file changed, 11 insertions(+), 4 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Verified
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
diff --git a/src/libvlr/vlr.c b/src/libvlr/vlr.c
index fc23b37..f98fee6 100644
--- a/src/libvlr/vlr.c
+++ b/src/libvlr/vlr.c
@@ -55,6 +55,8 @@
* Convenience functions
***********************************************************************/
+static int vlr_subscr_detach(struct vlr_subscr *vsub);
+
const struct value_string vlr_ciph_names[] = {
OSMO_VALUE_STRING(VLR_CIPH_NONE),
OSMO_VALUE_STRING(VLR_CIPH_A5_1),
@@ -578,7 +580,7 @@
continue;
LOGP(DVLR, LOGL_DEBUG, "%s: Location Update expired\n", vlr_subscr_name(vsub));
- vlr_subscr_rx_imsi_detach(vsub);
+ vlr_subscr_detach(vsub);
}
done:
@@ -1070,7 +1072,7 @@
vlr_gmm_cause_to_mm_cause(gsup_msg->cause, &gsm48_rej);
vlr_subscr_cancel_attach_fsm(vsub, fsm_cause, gsm48_rej);
- vlr_subscr_rx_imsi_detach(vsub);
+ vlr_subscr_detach(vsub);
return rc;
}
@@ -1236,8 +1238,7 @@
return false;
}
-/* See TS 23.012 version 9.10.0 4.3.2.1 "Process Detach_IMSI_VLR" */
-int vlr_subscr_rx_imsi_detach(struct vlr_subscr *vsub)
+static int vlr_subscr_detach(struct vlr_subscr *vsub)
{
/* paranoia: should any LU or PARQ FSMs still be running, stop them. */
vlr_subscr_cancel_attach_fsm(vsub, OSMO_FSM_TERM_ERROR, GSM48_REJECT_CONGESTION);
@@ -1253,6 +1254,12 @@
return 0;
}
+/* See TS 23.012 version 9.10.0 4.3.2.1 "Process Detach_IMSI_VLR" */
+int vlr_subscr_rx_imsi_detach(struct vlr_subscr *vsub)
+{
+ return vlr_subscr_detach(vsub);
+}
+
/* Tear down any running FSMs due to MSC connection timeout.
* Visit all vsub->*_fsm pointers and give them a queue to send a final reject
* message before the entire connection is torn down.
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/28115
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Iffc02f3062ad591ca372a3c6d866066cf63a8830
Gerrit-Change-Number: 28115
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/28113 )
Change subject: sms_queue: Annotate each function with some comment
......................................................................
sms_queue: Annotate each function with some comment
It makes the code much more readable if there's at least a one-liner
documenting each function (and struct member).
Change-Id: I6d239369cabdf1703eba7f3606b46b95cbbb1ea7
---
M src/libmsc/sms_queue.c
1 file changed, 47 insertions(+), 29 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved; Verified
pespin: Looks good to me, but someone else must approve
fixeria: Looks good to me, but someone else must approve
diff --git a/src/libmsc/sms_queue.c b/src/libmsc/sms_queue.c
index 6098a53..63d9631 100644
--- a/src/libmsc/sms_queue.c
+++ b/src/libmsc/sms_queue.c
@@ -43,35 +43,39 @@
#include <osmocom/vty/vty.h>
-/*
- * One pending SMS that we wait for.
- */
+/* One in-RAM record of a "pending SMS". This is not the SMS itself, but merely
+ * a pointer to the database record. It holds a reference on the vlr_subscriber
+ * and some counters. While this object exists in RAM, we are regularly attempting
+ * to deliver the related SMS. */
struct gsm_sms_pending {
- struct llist_head entry;
+ struct llist_head entry; /* gsm_sms_queue.pending_sms */
- struct vlr_subscr *vsub;
- struct msc_a *msc_a;
- unsigned long long sms_id;
- int failed_attempts;
- int resend;
+ struct vlr_subscr *vsub; /* destination subscriber for this SMS */
+ struct msc_a *msc_a; /* MSC_A associated with this SMS */
+ unsigned long long sms_id; /* unique ID (in SQL database) of this SMS */
+ int failed_attempts; /* count of failed deliver attempts so far */
+ int resend; /* should we try re-sending it (now) ? */
};
+/* (global) state of the SMS queue. */
struct gsm_sms_queue {
- struct osmo_timer_list resend_pending;
- struct osmo_timer_list push_queue;
+ struct osmo_timer_list resend_pending; /* timer triggering sms_resend_pending() */
+ struct osmo_timer_list push_queue; /* timer triggering sms_submit_pending() */
struct gsm_network *network;
- int max_fail;
- int max_pending;
- int pending;
+ int max_fail; /* maximum number of delivery failures */
+ int max_pending; /* maximum number of gsm_sms_pending in RAM */
+ int pending; /* current number of gsm_sms_pending in RAM */
- struct llist_head pending_sms;
+ struct llist_head pending_sms; /* list of gsm_sms_pending */
+ /* last MSISDN for which we read SMS from the database and created gsm_sms_pending records */
char last_msisdn[GSM23003_MSISDN_MAX_DIGITS+1];
};
static int sms_subscr_cb(unsigned int, unsigned int, void *, void *);
static int sms_sms_cb(unsigned int, unsigned int, void *, void *);
+/* look-up a 'gsm_sms_pending' for the given sms_id; return NULL if none */
static struct gsm_sms_pending *sms_find_pending(struct gsm_sms_queue *smsq,
unsigned long long sms_id)
{
@@ -85,11 +89,13 @@
return NULL;
}
+/* do we currently have a gsm_sms_pending object for the given SMS id? */
int sms_queue_sms_is_pending(struct gsm_sms_queue *smsq, unsigned long long sms_id)
{
return sms_find_pending(smsq, sms_id) != NULL;
}
+/* find the first pending SMS (in RAM) for the given subscriber */
static struct gsm_sms_pending *sms_subscriber_find_pending(
struct gsm_sms_queue *smsq,
struct vlr_subscr *vsub)
@@ -104,12 +110,14 @@
return NULL;
}
+/* do we have any pending SMS (in RAM) for the given subscriber? */
static int sms_subscriber_is_pending(struct gsm_sms_queue *smsq,
struct vlr_subscr *vsub)
{
return sms_subscriber_find_pending(smsq, vsub) != NULL;
}
+/* allocate a new gsm_sms_pending record and fill it with information from 'sms' */
static struct gsm_sms_pending *sms_pending_from(struct gsm_sms_queue *smsq,
struct gsm_sms *sms)
{
@@ -125,6 +133,7 @@
return pending;
}
+/* release a gsm_sms_pending object */
static void sms_pending_free(struct gsm_sms_pending *pending)
{
vlr_subscr_put(pending->vsub, VSUB_USE_SMS_PENDING);
@@ -132,6 +141,8 @@
talloc_free(pending);
}
+/* this sets the 'resend' flag of the gsm_sms_pending and schedules
+ * the timer for re-sending */
static void sms_pending_resend(struct gsm_sms_pending *pending)
{
struct gsm_network *net = pending->vsub->vlr->user_ctx;
@@ -148,6 +159,8 @@
osmo_timer_schedule(&smsq->resend_pending, 1, 0);
}
+/* call-back when a pending SMS has failed; try another re-send if number of
+ * attempts is < smsq->max_fail */
static void sms_pending_failed(struct gsm_sms_pending *pending, int paging_error)
{
struct gsm_network *net = pending->vsub->vlr->user_ctx;
@@ -165,10 +178,10 @@
smsq->pending -= 1;
}
-/*
- * Resend all SMS that are scheduled for a resend. This is done to
- * avoid an immediate failure.
- */
+/* Resend all SMS that are scheduled for a resend. This is done to
+ * avoid an immediate failure. This iterates over all the (in RAM)
+ * pending_sms records, checks for resend == true, reads them from the
+ * DB and attempts to send them via gsm411_send_sms() */
static void sms_resend_pending(void *_data)
{
struct gsm_sms_pending *pending, *tmp;
@@ -244,10 +257,10 @@
return NULL;
}
-/**
- * I will submit up to max_pending - pending SMS to the
- * subsystem.
- */
+/* read up to 'max_pending' pending SMS from the database and add them to the in-memory
+ * sms_queue; trigger the first delivery attempt. 'submit' in this context means
+ * "read from the database and add to the in-memory gsm_sms_queue" and is not to be
+ * confused with the SMS SUBMIT operation a MS performs when sending a MO-SMS. */
static void sms_submit_pending(void *_data)
{
struct gsm_sms_queue *smsq = _data;
@@ -309,6 +322,7 @@
continue;
}
+ /* allocate a new gsm_sms_pending object in RAM */
pending = sms_pending_from(smsq, sms);
if (!pending) {
LOGP(DLSMS, LOGL_ERROR,
@@ -326,9 +340,10 @@
LOGP(DLSMS, LOGL_DEBUG, "SMSqueue added %d messages in %d rounds\n", attempted, rounds);
}
-/**
- * Send the next SMS or trigger the queue
- */
+/* obtain the next pending SMS for given subscriber from database,
+ * create gsm_sms_pending object and attempt first delivery. If there
+ * are no SMS pending for the given subscriber, call sms_submit_pending()
+ * to read more SMS (for any subscriber) into the in-RAM pending queue */
static void sms_send_next(struct vlr_subscr *vsub)
{
struct gsm_network *net = vsub->vlr->user_ctx;
@@ -366,9 +381,7 @@
sms_submit_pending(net->sms_queue);
}
-/*
- * Kick off the queue again.
- */
+/* Trigger a call to sms_submit_pending() in one second */
int sms_queue_trigger(struct gsm_sms_queue *smsq)
{
LOGP(DLSMS, LOGL_DEBUG, "Triggering SMS queue\n");
@@ -379,6 +392,8 @@
return 0;
}
+/* initialize the sms_queue subsystem and read the first batch of SMS from
+ * the database for delivery */
int sms_queue_start(struct gsm_network *network, int max_pending)
{
struct gsm_sms_queue *sms = talloc_zero(network, struct gsm_sms_queue);
@@ -403,6 +418,7 @@
return 0;
}
+/* call-back: Given subscriber is now ready for short messages. */
static int sub_ready_for_sm(struct gsm_network *net, struct vlr_subscr *vsub)
{
struct gsm_sms *sms;
@@ -440,6 +456,7 @@
return 0;
}
+/* call-back for SS_SUBSCR signals */
static int sms_subscr_cb(unsigned int subsys, unsigned int signal,
void *handler_data, void *signal_data)
{
@@ -452,6 +469,7 @@
return sub_ready_for_sm(handler_data, vsub);
}
+/* call-back for SS_SMS signals */
static int sms_sms_cb(unsigned int subsys, unsigned int signal,
void *handler_data, void *signal_data)
{
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/28113
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I6d239369cabdf1703eba7f3606b46b95cbbb1ea7
Gerrit-Change-Number: 28113
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/28113 )
Change subject: sms_queue: Annotate each function with some comment
......................................................................
Patch Set 3: Verified+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/28113
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I6d239369cabdf1703eba7f3606b46b95cbbb1ea7
Gerrit-Change-Number: 28113
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 16 May 2022 10:10:51 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment