Change in osmo-bsc[master]: paging: Introduce VTY configurable X3113 (Maximum Paging Request Tran...

2022-11-29 Thread pespin
pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/30345 )

Change subject: paging: Introduce VTY configurable X3113 (Maximum Paging 
Request Transmit Delay Threshold)
..

paging: Introduce VTY configurable X3113 (Maximum Paging Request Transmit Delay 
Threshold)

This allows configuring the maximum delay of paging requests to be
queued according to other parameters, such as MSC paging request
timeouts, etc.

Related: OS#5552
Change-Id: Ia556ef4e474e6a2d0d1618bab680a3330a3c062b
---
M include/osmocom/bsc/paging.h
M src/osmo-bsc/net_init.c
M src/osmo-bsc/paging.c
M tests/timer.vty
4 files changed, 25 insertions(+), 9 deletions(-)

Approvals:
  Jenkins Builder: Verified
  neels: Looks good to me, but someone else must approve
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



diff --git a/include/osmocom/bsc/paging.h b/include/osmocom/bsc/paging.h
index 720ee1c..dd1bb9e 100644
--- a/include/osmocom/bsc/paging.h
+++ b/include/osmocom/bsc/paging.h
@@ -53,6 +53,14 @@
BSC_PAGING_FOR_LCS = 0x2,
 };

+/* OS#5552, OS#5553: Maximum allowed scheduling transmit delay in paging
+ * requests to be queued, in seconds. If calculated delay for requests to be
+ * queued goes over this threshold, they are discarded instead of inserted to
+ * the queue. This avoids keeping queueing requests which will be scheduled for
+ * transmission too late.
+ */
+#define PAGING_THRESHOLD_X3113_DEFAULT_SEC 60
+
 struct bsc_paging_params {
enum bsc_paging_reason reason;
struct bsc_msc_data *msc;
diff --git a/src/osmo-bsc/net_init.c b/src/osmo-bsc/net_init.c
index ad2f9bf..75dcbf3 100644
--- a/src/osmo-bsc/net_init.c
+++ b/src/osmo-bsc/net_init.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 

 static struct osmo_tdef gsm_network_T_defs[] = {
{ .T = 4, .default_val = 5, .desc = "Timeout to receive BSSMAP RESET 
ACKNOWLEDGE from the MSC" },
@@ -74,6 +75,11 @@
" keep remainders. See also X16, X17." },
{ .T = -25, .default_val = 5, .desc = "Timeout for initial user data 
after an MSC initiated an SCCP connection to the BSS" },
{ .T = -3111, .default_val = 4, .desc = "Wait time after lchan was 
released in error (should be T3111 + 2s)" },
+   { .T = -3113, .default_val = PAGING_THRESHOLD_X3113_DEFAULT_SEC,
+   .desc = "Maximum Paging Request Transmit Delay Threshold: " \
+   "If the estimated transmit delay of the messages of the 
paging queue surpasses this threshold, new incoming "
+   "paging requests are discarded, hence limiting the size 
of the queue and maximum delay of its scheduled requests. "
+   "X3113 also serves as the upper boundary for dynamic 
T3113 when estimating the expected maximum delay to get a response" },
{ .T = -3210, .default_val = 20, .desc = "After L3 Complete, wait for 
MSC to confirm" },
{}
 };
diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c
index 0395c14..a3f4e84 100644
--- a/src/osmo-bsc/paging.c
+++ b/src/osmo-bsc/paging.c
@@ -61,8 +61,6 @@
 /* How many paging requests to Tx on RSL at max before going back to main loop 
*/
 #define MAX_PAGE_REQ_PER_ITER 10

-#define MAX_TX_DELAY_TIME_SEC 60
-
 /* How often to attempt sending new paging requests (initial, not retrans): 
250ms */
 static const struct timespec initial_period = {
.tv_sec = 0,
@@ -355,7 +353,7 @@
 unsigned int num_reqs_same_pgroup);

 static unsigned int calculate_timer_3113(struct gsm_paging_request *req, 
unsigned int reqs_before,
-unsigned int reqs_before_same_pgroup)
+unsigned int reqs_before_same_pgroup, 
unsigned int max_dynamic_value)
 {
unsigned int to_us, estimated_to, to;
struct gsm_bts *bts = req->bts;
@@ -389,9 +387,9 @@
/* ceiling in seconds + extra time */
estimated_to = (to_us + 99) / 100 + d->val;

-   /* upper bound: 60s (OS#5553) */
-   if (estimated_to > MAX_TX_DELAY_TIME_SEC)
-   to = MAX_TX_DELAY_TIME_SEC;
+   /* upper bound: see X3113, PAGING_THRESHOLD_X3113_DEFAULT_SEC */
+   if (estimated_to > max_dynamic_value)
+   to = max_dynamic_value;
else
to = estimated_to;

@@ -414,14 +412,16 @@
struct gsm_bts_paging_state *bts_entry = >paging;
struct gsm_paging_request *req, *last_initial_req = NULL;
unsigned int t3113_timeout_s;
+   unsigned int x3113_s = osmo_tdef_get(bts->network->T_defs, -3113, 
OSMO_TDEF_S, -1);
unsigned int reqs_before = 0, reqs_before_same_pgroup = 0;
uint8_t pgroup = gsm0502_calc_paging_group(>si_common.chan_desc,
   
str_to_imsi(params->bsub->imsi));


Change in osmo-bsc[master]: paging: Introduce VTY configurable X3113 (Maximum Paging Request Tran...

2022-11-29 Thread pespin
Attention is currently required from: neels, fixeria.
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/30345 )

Change subject: paging: Introduce VTY configurable X3113 (Maximum Paging 
Request Transmit Delay Threshold)
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30345
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ia556ef4e474e6a2d0d1618bab680a3330a3c062b
Gerrit-Change-Number: 30345
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: pespin 
Gerrit-Attention: neels 
Gerrit-Attention: fixeria 
Gerrit-Comment-Date: Tue, 29 Nov 2022 11:34:27 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-bsc[master]: paging: Introduce VTY configurable X3113 (Maximum Paging Request Tran...

2022-11-28 Thread laforge
Attention is currently required from: neels, pespin, fixeria.
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/30345 )

Change subject: paging: Introduce VTY configurable X3113 (Maximum Paging 
Request Transmit Delay Threshold)
..


Patch Set 2: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30345
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ia556ef4e474e6a2d0d1618bab680a3330a3c062b
Gerrit-Change-Number: 30345
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: neels 
Gerrit-Attention: neels 
Gerrit-Attention: pespin 
Gerrit-Attention: fixeria 
Gerrit-Comment-Date: Tue, 29 Nov 2022 07:33:09 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-bsc[master]: paging: Introduce VTY configurable X3113 (Maximum Paging Request Tran...

2022-11-28 Thread pespin
Attention is currently required from: neels, fixeria.
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/30345 )

Change subject: paging: Introduce VTY configurable X3113 (Maximum Paging 
Request Transmit Delay Threshold)
..


Patch Set 2:

(1 comment)

File src/osmo-bsc/net_init.c:

https://gerrit.osmocom.org/c/osmo-bsc/+/30345/comment/bbd3144b_417a01b8
PS1, Line 78: PAGING_THRESHOLD_X3113_DEFAULT_SEC
> IMHO write "see X3113"; we can agree to disagree
I prefer keeping different output for programmers looking at the code and users 
looking at the VTY.



--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30345
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ia556ef4e474e6a2d0d1618bab680a3330a3c062b
Gerrit-Change-Number: 30345
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: neels 
Gerrit-Attention: neels 
Gerrit-Attention: fixeria 
Gerrit-Comment-Date: Mon, 28 Nov 2022 20:34:55 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: neels 
Comment-In-Reply-To: pespin 
Gerrit-MessageType: comment


Change in osmo-bsc[master]: paging: Introduce VTY configurable X3113 (Maximum Paging Request Tran...

2022-11-28 Thread neels
Attention is currently required from: fixeria, pespin.
neels has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/30345 )

Change subject: paging: Introduce VTY configurable X3113 (Maximum Paging 
Request Transmit Delay Threshold)
..


Patch Set 2: Code-Review+1

(3 comments)

File src/osmo-bsc/net_init.c:

https://gerrit.osmocom.org/c/osmo-bsc/+/30345/comment/92d8f4c9_0fe37eb5
PS1, Line 78: PAGING_THRESHOLD_X3113_DEFAULT_SEC
> I prefer keeping it in a define in paging. […]
IMHO write "see X3113"; we can agree to disagree


File src/osmo-bsc/paging.c:

https://gerrit.osmocom.org/c/osmo-bsc/+/30345/comment/406131fc_24ad99c8
PS1, Line 415: struct osmo_tdef *td_x3113
> const
Done


https://gerrit.osmocom.org/c/osmo-bsc/+/30345/comment/fa41ef74_71b8f3e9
PS1, Line 415:  struct osmo_tdef *td_x3113 = 
osmo_tdef_get_entry(bts->network->T_defs, -3113);
> actually it is documented […]
Done



--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30345
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ia556ef4e474e6a2d0d1618bab680a3330a3c062b
Gerrit-Change-Number: 30345
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: neels 
Gerrit-Attention: fixeria 
Gerrit-Attention: pespin 
Gerrit-Comment-Date: Mon, 28 Nov 2022 15:58:14 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: neels 
Comment-In-Reply-To: pespin 
Comment-In-Reply-To: fixeria 
Gerrit-MessageType: comment


Change in osmo-bsc[master]: paging: Introduce VTY configurable X3113 (Maximum Paging Request Tran...

2022-11-28 Thread pespin
Attention is currently required from: neels.
Hello Jenkins Builder, fixeria,

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

https://gerrit.osmocom.org/c/osmo-bsc/+/30345

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

Change subject: paging: Introduce VTY configurable X3113 (Maximum Paging 
Request Transmit Delay Threshold)
..

paging: Introduce VTY configurable X3113 (Maximum Paging Request Transmit Delay 
Threshold)

This allows configuring the maximum delay of paging requests to be
queued according to other parameters, such as MSC paging request
timeouts, etc.

Related: OS#5552
Change-Id: Ia556ef4e474e6a2d0d1618bab680a3330a3c062b
---
M include/osmocom/bsc/paging.h
M src/osmo-bsc/net_init.c
M src/osmo-bsc/paging.c
M tests/timer.vty
4 files changed, 25 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/45/30345/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30345
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ia556ef4e474e6a2d0d1618bab680a3330a3c062b
Gerrit-Change-Number: 30345
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-CC: neels 
Gerrit-Attention: neels 
Gerrit-MessageType: newpatchset


Change in osmo-bsc[master]: paging: Introduce VTY configurable X3113 (Maximum Paging Request Tran...

2022-11-28 Thread pespin
Attention is currently required from: neels.
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/30345 )

Change subject: paging: Introduce VTY configurable X3113 (Maximum Paging 
Request Transmit Delay Threshold)
..


Patch Set 1:

(2 comments)

Commit Message:

https://gerrit.osmocom.org/c/osmo-bsc/+/30345/comment/63285b51_2b45bfb6
PS1, Line 11: timeouts, etc.
> i'm having a hard time understanding this, clarify a bit? […]
T3113 defines the amount of time that a response for a paging request is 
expected to take at maximum. Hence after T3113 timeouts the request can be 
freed/retransmitted because we now for sure that there's no answer for it.


File src/osmo-bsc/net_init.c:

https://gerrit.osmocom.org/c/osmo-bsc/+/30345/comment/de69a62b_678d0cc7
PS1, Line 78: PAGING_THRESHOLD_X3113_DEFAULT_SEC
> AFAICT this is the only place where this #define is used. […]
I prefer keeping it in a define in paging.h, where I can describe better the 
meaning of it, where all related paging information is located.



--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30345
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ia556ef4e474e6a2d0d1618bab680a3330a3c062b
Gerrit-Change-Number: 30345
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-CC: neels 
Gerrit-Attention: neels 
Gerrit-Comment-Date: Mon, 28 Nov 2022 15:17:13 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: neels 
Gerrit-MessageType: comment


Change in osmo-bsc[master]: paging: Introduce VTY configurable X3113 (Maximum Paging Request Tran...

2022-11-28 Thread fixeria
Attention is currently required from: pespin.
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/30345 )

Change subject: paging: Introduce VTY configurable X3113 (Maximum Paging 
Request Transmit Delay Threshold)
..


Patch Set 1: -Code-Review


--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30345
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ia556ef4e474e6a2d0d1618bab680a3330a3c062b
Gerrit-Change-Number: 30345
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-CC: neels 
Gerrit-Attention: pespin 
Gerrit-Comment-Date: Mon, 28 Nov 2022 14:19:58 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-bsc[master]: paging: Introduce VTY configurable X3113 (Maximum Paging Request Tran...

2022-11-28 Thread neels
Attention is currently required from: pespin.
neels has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/30345 )

Change subject: paging: Introduce VTY configurable X3113 (Maximum Paging 
Request Transmit Delay Threshold)
..


Patch Set 1:

(1 comment)

File src/osmo-bsc/paging.c:

https://gerrit.osmocom.org/c/osmo-bsc/+/30345/comment/b65c2faa_b541bd35
PS1, Line 415:  struct osmo_tdef *td_x3113 = 
osmo_tdef_get_entry(bts->network->T_defs, -3113);
> the API intended way to do  […]
actually it is documented

 abort the program if default < 0

but could be more prominent



--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30345
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ia556ef4e474e6a2d0d1618bab680a3330a3c062b
Gerrit-Change-Number: 30345
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-CC: neels 
Gerrit-Attention: pespin 
Gerrit-Comment-Date: Mon, 28 Nov 2022 14:16:03 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: neels 
Gerrit-MessageType: comment


Change in osmo-bsc[master]: paging: Introduce VTY configurable X3113 (Maximum Paging Request Tran...

2022-11-28 Thread neels
Attention is currently required from: pespin.
neels has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/30345 )

Change subject: paging: Introduce VTY configurable X3113 (Maximum Paging 
Request Transmit Delay Threshold)
..


Patch Set 1:

(4 comments)

Commit Message:

https://gerrit.osmocom.org/c/osmo-bsc/+/30345/comment/76adbf6e_76ec75ed
PS1, Line 11: timeouts, etc.
i'm having a hard time understanding this, clarify a bit?
is this an accurate explanation: "we discard paging requests when the paging 
queue is too long to deliver the request in time. T3113 defines this time." ?

How does it relate to `timer T3113` and `timer-dynamic T3113`


File src/osmo-bsc/net_init.c:

https://gerrit.osmocom.org/c/osmo-bsc/+/30345/comment/25a5cb96_76e1e413
PS1, Line 78: PAGING_THRESHOLD_X3113_DEFAULT_SEC
AFAICT this is the only place where this #define is used. just put the number 
here, like for all the other X and T timers?


https://gerrit.osmocom.org/c/osmo-bsc/+/30345/comment/32640850_d42b5cde
PS1, Line 80:"Drop new paging requests estimated to be 
scheduled too far in the future due to current queue length"},
as a user this leaves me curious and uninformed about how T3113 and X3113 
relate. There is no limit on the length of VTY doc, it gets formatted nicely on 
telnet and adds valuable info to the vty reference pdf, so do explain 
elaborately


File src/osmo-bsc/paging.c:

https://gerrit.osmocom.org/c/osmo-bsc/+/30345/comment/fbc5d029_61068750
PS1, Line 415:  struct osmo_tdef *td_x3113 = 
osmo_tdef_get_entry(bts->network->T_defs, -3113);
the API intended way to do

  td = osmo_tdef_get_entry(...);
  OSMO_ASSERT(td);
  use(td->val);

is

  use(osmo_tdef_get(T_defs, -3113, OSMO_TDEF_S, -1));

The -1 gives you an implicit OSMO_ASSERT(), and the OSMO_TDEF_S still gives you 
the expected value in seconds even if we were to change the default to "1, 
OSMO_TDEF_M" = 1 minute in the T_defs.

Hmm, I'm just noticing that the assert part is not documented properly in the 
API doc of osmo_tdef_get(), I'll fix



--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30345
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ia556ef4e474e6a2d0d1618bab680a3330a3c062b
Gerrit-Change-Number: 30345
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-CC: neels 
Gerrit-Attention: pespin 
Gerrit-Comment-Date: Mon, 28 Nov 2022 14:13:55 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in osmo-bsc[master]: paging: Introduce VTY configurable X3113 (Maximum Paging Request Tran...

2022-11-28 Thread fixeria
Attention is currently required from: pespin.
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/30345 )

Change subject: paging: Introduce VTY configurable X3113 (Maximum Paging 
Request Transmit Delay Threshold)
..


Patch Set 1:

(1 comment)

File src/osmo-bsc/paging.c:

https://gerrit.osmocom.org/c/osmo-bsc/+/30345/comment/8b723b4a_643b13de
PS1, Line 415: struct osmo_tdef *td_x3113
const



--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30345
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ia556ef4e474e6a2d0d1618bab680a3330a3c062b
Gerrit-Change-Number: 30345
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Attention: pespin 
Gerrit-Comment-Date: Mon, 28 Nov 2022 14:13:46 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in osmo-bsc[master]: paging: Introduce VTY configurable X3113 (Maximum Paging Request Tran...

2022-11-28 Thread fixeria
Attention is currently required from: pespin.
fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/30345 )

Change subject: paging: Introduce VTY configurable X3113 (Maximum Paging 
Request Transmit Delay Threshold)
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30345
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ia556ef4e474e6a2d0d1618bab680a3330a3c062b
Gerrit-Change-Number: 30345
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Attention: pespin 
Gerrit-Comment-Date: Mon, 28 Nov 2022 14:11:38 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-bsc[master]: paging: Introduce VTY configurable X3113 (Maximum Paging Request Tran...

2022-11-28 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/30345 )


Change subject: paging: Introduce VTY configurable X3113 (Maximum Paging 
Request Transmit Delay Threshold)
..

paging: Introduce VTY configurable X3113 (Maximum Paging Request Transmit Delay 
Threshold)

This allows configuring the maximum delay of paging requests to be
queued according to other parameters, such as MSC paging request
timeouts, etc.

Related: OS#5552
Change-Id: Ia556ef4e474e6a2d0d1618bab680a3330a3c062b
---
M include/osmocom/bsc/paging.h
M src/osmo-bsc/net_init.c
M src/osmo-bsc/paging.c
M tests/timer.vty
4 files changed, 24 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/45/30345/1

diff --git a/include/osmocom/bsc/paging.h b/include/osmocom/bsc/paging.h
index 720ee1c..dd1bb9e 100644
--- a/include/osmocom/bsc/paging.h
+++ b/include/osmocom/bsc/paging.h
@@ -53,6 +53,14 @@
BSC_PAGING_FOR_LCS = 0x2,
 };

+/* OS#5552, OS#5553: Maximum allowed scheduling transmit delay in paging
+ * requests to be queued, in seconds. If calculated delay for requests to be
+ * queued goes over this threshold, they are discarded instead of inserted to
+ * the queue. This avoids keeping queueing requests which will be scheduled for
+ * transmission too late.
+ */
+#define PAGING_THRESHOLD_X3113_DEFAULT_SEC 60
+
 struct bsc_paging_params {
enum bsc_paging_reason reason;
struct bsc_msc_data *msc;
diff --git a/src/osmo-bsc/net_init.c b/src/osmo-bsc/net_init.c
index ad2f9bf..c7eda2c 100644
--- a/src/osmo-bsc/net_init.c
+++ b/src/osmo-bsc/net_init.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 

 static struct osmo_tdef gsm_network_T_defs[] = {
{ .T = 4, .default_val = 5, .desc = "Timeout to receive BSSMAP RESET 
ACKNOWLEDGE from the MSC" },
@@ -74,6 +75,9 @@
" keep remainders. See also X16, X17." },
{ .T = -25, .default_val = 5, .desc = "Timeout for initial user data 
after an MSC initiated an SCCP connection to the BSS" },
{ .T = -3111, .default_val = 4, .desc = "Wait time after lchan was 
released in error (should be T3111 + 2s)" },
+   { .T = -3113, .default_val = PAGING_THRESHOLD_X3113_DEFAULT_SEC,
+   .desc = "Maximum Paging Request Transmit Delay Threshold: " \
+"Drop new paging requests estimated to be scheduled 
too far in the future due to current queue length"},
{ .T = -3210, .default_val = 20, .desc = "After L3 Complete, wait for 
MSC to confirm" },
{}
 };
diff --git a/src/osmo-bsc/paging.c b/src/osmo-bsc/paging.c
index 0395c14..32ae627 100644
--- a/src/osmo-bsc/paging.c
+++ b/src/osmo-bsc/paging.c
@@ -61,8 +61,6 @@
 /* How many paging requests to Tx on RSL at max before going back to main loop 
*/
 #define MAX_PAGE_REQ_PER_ITER 10

-#define MAX_TX_DELAY_TIME_SEC 60
-
 /* How often to attempt sending new paging requests (initial, not retrans): 
250ms */
 static const struct timespec initial_period = {
.tv_sec = 0,
@@ -355,7 +353,7 @@
 unsigned int num_reqs_same_pgroup);

 static unsigned int calculate_timer_3113(struct gsm_paging_request *req, 
unsigned int reqs_before,
-unsigned int reqs_before_same_pgroup)
+unsigned int reqs_before_same_pgroup, 
unsigned int max_dynamic_value)
 {
unsigned int to_us, estimated_to, to;
struct gsm_bts *bts = req->bts;
@@ -389,9 +387,9 @@
/* ceiling in seconds + extra time */
estimated_to = (to_us + 99) / 100 + d->val;

-   /* upper bound: 60s (OS#5553) */
-   if (estimated_to > MAX_TX_DELAY_TIME_SEC)
-   to = MAX_TX_DELAY_TIME_SEC;
+   /* upper bound: see X3113, PAGING_THRESHOLD_X3113_DEFAULT_SEC */
+   if (estimated_to > max_dynamic_value)
+   to = max_dynamic_value;
else
to = estimated_to;

@@ -414,14 +412,17 @@
struct gsm_bts_paging_state *bts_entry = >paging;
struct gsm_paging_request *req, *last_initial_req = NULL;
unsigned int t3113_timeout_s;
+   struct osmo_tdef *td_x3113 = osmo_tdef_get_entry(bts->network->T_defs, 
-3113);
unsigned int reqs_before = 0, reqs_before_same_pgroup = 0;
uint8_t pgroup = gsm0502_calc_paging_group(>si_common.chan_desc,
   
str_to_imsi(params->bsub->imsi));

rate_ctr_inc(rate_ctr_group_get_ctr(bts->bts_ctrs, 
BTS_CTR_PAGING_ATTEMPTED));

-   /* don't try to queue more requests than we can realistically handle 
within MAX_TX_DELAY_TIME_SEC seconds */
-   if (paging_pending_requests_nr(bts) > 
paging_estimate_available_slots(bts, MAX_TX_DELAY_TIME_SEC)) {
+   /* Don't try to queue more requests than we can realistically handle 
within X3113 seconds,
+