This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/22449 )
Change subject: NACC: allow setting keep time for entries in neigh and si cache
......................................................................
NACC: allow setting keep time for entries in neigh and si cache
Related: SYS#4909
Change-Id: Ifa336aa27dd88ff5b78dbc5a2799740f542bb369
---
M src/gprs_pcu.c
M src/gprs_pcu.h
M src/neigh_cache.c
M src/neigh_cache.h
M src/pcu_vty.c
5 files changed, 45 insertions(+), 15 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/49/22449/1
diff --git a/src/gprs_pcu.c b/src/gprs_pcu.c
index 9679914..f1079b8 100644
--- a/src/gprs_pcu.c
+++ b/src/gprs_pcu.c
@@ -33,6 +33,8 @@
{ .T=1, .default_val=30, .unit=OSMO_TDEF_S, .desc="BSSGP (un)blocking procedures timer (s)", .val=0 },
{ .T=2, .default_val=30, .unit=OSMO_TDEF_S, .desc="BSSGP reset procedure timer (s)", .val=0 },
{ .T=3190, .default_val=5, .unit=OSMO_TDEF_S, .desc="Return to packet idle mode after Packet DL Assignment on CCCH (s)", .val=0},
+ { .T=PCU_TDEF_NEIGH_CACHE_ALIVE, .default_val=5, .unit=OSMO_TDEF_S, .desc="[ARFCN+BSIC]->[RAC+CI] resolution cache entry storage timeout (s)", .val=0 },
+ { .T=PCU_TDEF_SI_CACHE_ALIVE, .default_val=5, .unit=OSMO_TDEF_S, .desc="[RAC+CI]->[SI] resolution cache entry storage timeout (s)", .val=0 },
{ .T=-2000, .default_val=2, .unit=OSMO_TDEF_MS, .desc="Tbf reject for PRR timer (ms)", .val=0 },
{ .T=-2001, .default_val=2, .unit=OSMO_TDEF_S, .desc="PACCH assignment timer (s)", .val=0 },
{ .T=-2002, .default_val=200, .unit=OSMO_TDEF_MS, .desc="Waiting after IMM.ASS confirm timer (ms)", .val=0 },
@@ -114,8 +116,8 @@
INIT_LLIST_HEAD(&pcu->bts_list);
- pcu->neigh_cache = neigh_cache_alloc(pcu);
- pcu->si_cache = si_cache_alloc(pcu);
+ pcu->neigh_cache = neigh_cache_alloc(pcu, osmo_tdef_get(pcu->T_defs, PCU_TDEF_NEIGH_CACHE_ALIVE, OSMO_TDEF_S, -1));
+ pcu->si_cache = si_cache_alloc(pcu, osmo_tdef_get(pcu->T_defs, PCU_TDEF_SI_CACHE_ALIVE, OSMO_TDEF_S, -1));
return pcu;
}
diff --git a/src/gprs_pcu.h b/src/gprs_pcu.h
index 8e18f89..4f22f68 100644
--- a/src/gprs_pcu.h
+++ b/src/gprs_pcu.h
@@ -37,6 +37,9 @@
#define MAX_EDGE_MCS 9
#define MAX_GPRS_CS 4
+#define PCU_TDEF_NEIGH_CACHE_ALIVE (-10)
+#define PCU_TDEF_SI_CACHE_ALIVE (-11)
+
/* see bts->gsmtap_categ_mask */
enum pcu_gsmtap_category {
PCU_GSMTAP_C_DL_UNKNOWN = 0, /* unknown or undecodable downlink blocks */
diff --git a/src/neigh_cache.c b/src/neigh_cache.c
index cf77dc8..f5cdc55 100644
--- a/src/neigh_cache.c
+++ b/src/neigh_cache.c
@@ -25,10 +25,6 @@
#include <neigh_cache.h>
-#define KEEP_TIME_DEFAULT_SEC 5
-
-/*TODO: add a timer to the_pcu T_defs, pass value to struct neigh_cache instead of KEEP_TIME_DEFAULT_SEC */
-
static void neigh_cache_schedule_cleanup(struct neigh_cache *cache);
static void neigh_cache_cleanup_cb(void *data) {
struct timespec now, threshold;
@@ -72,15 +68,22 @@
}
}
-struct neigh_cache *neigh_cache_alloc(void *ctx)
+struct neigh_cache *neigh_cache_alloc(void *ctx, unsigned int keep_time_sec)
{
struct neigh_cache *cache = talloc_zero(ctx, struct neigh_cache);
INIT_LLIST_HEAD(&cache->list);
osmo_timer_setup(&cache->cleanup_timer, neigh_cache_cleanup_cb, cache);
- cache->keep_time_intval = (struct timespec){ .tv_sec = KEEP_TIME_DEFAULT_SEC, .tv_nsec = 0};
+ cache->keep_time_intval = (struct timespec){ .tv_sec = keep_time_sec, .tv_nsec = 0};
return cache;
}
+
+void neigh_cache_set_keep_time_interval(struct neigh_cache *cache, unsigned int keep_time_sec)
+{
+ cache->keep_time_intval = (struct timespec){ .tv_sec = keep_time_sec, .tv_nsec = 0};
+ neigh_cache_schedule_cleanup(cache);
+}
+
struct neigh_cache_entry *neigh_cache_add(struct neigh_cache *cache,
const struct neigh_cache_entry_key *key,
const struct osmo_cell_global_id_ps *value)
@@ -143,8 +146,6 @@
// SI CACHE
///////////////////
-/*TODO: add a timer to the_pcu T_defs, pass value to struct neigh_cache instead of KEEP_TIME_DEFAULT_SEC */
-
static void si_cache_schedule_cleanup(struct si_cache *cache);
static void si_cache_cleanup_cb(void *data) {
struct timespec now, threshold;
@@ -188,14 +189,21 @@
}
}
-struct si_cache *si_cache_alloc(void *ctx)
+struct si_cache *si_cache_alloc(void *ctx, unsigned int keep_time_sec)
{
struct si_cache *cache = talloc_zero(ctx, struct si_cache);
INIT_LLIST_HEAD(&cache->list);
osmo_timer_setup(&cache->cleanup_timer, si_cache_cleanup_cb, cache);
- cache->keep_time_intval = (struct timespec){ .tv_sec = KEEP_TIME_DEFAULT_SEC, .tv_nsec = 0};
+ cache->keep_time_intval = (struct timespec){ .tv_sec = keep_time_sec, .tv_nsec = 0};
return cache;
}
+
+void si_cache_set_keep_time_interval(struct si_cache *cache, unsigned int keep_time_sec)
+{
+ cache->keep_time_intval = (struct timespec){ .tv_sec = keep_time_sec, .tv_nsec = 0};
+ si_cache_schedule_cleanup(cache);
+}
+
struct si_cache_entry *si_cache_add(struct si_cache *cache,
const struct osmo_cell_global_id_ps *key,
const struct si_cache_value *value)
diff --git a/src/neigh_cache.h b/src/neigh_cache.h
index 4e7bb2c..bee388f 100644
--- a/src/neigh_cache.h
+++ b/src/neigh_cache.h
@@ -52,7 +52,8 @@
struct osmo_cell_global_id_ps value;
};
-struct neigh_cache *neigh_cache_alloc(void *ctx);
+struct neigh_cache *neigh_cache_alloc(void *ctx, unsigned int keep_time_sec);
+void neigh_cache_set_keep_time_interval(struct neigh_cache *cache, unsigned int keep_time_sec);
struct neigh_cache_entry *neigh_cache_add(struct neigh_cache *cache,
const struct neigh_cache_entry_key *key,
const struct osmo_cell_global_id_ps *value);
@@ -87,7 +88,8 @@
struct si_cache_value value;
};
-struct si_cache *si_cache_alloc(void *ctx);
+struct si_cache *si_cache_alloc(void *ctx, unsigned int keep_time_sec);
+void si_cache_set_keep_time_interval(struct si_cache *cache, unsigned int keep_time_sec);
struct si_cache_entry *si_cache_add(struct si_cache *cache,
const struct osmo_cell_global_id_ps *key,
const struct si_cache_value *value);
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index b7021c8..60fbc7d 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -1064,10 +1064,25 @@
OSMO_TDEF_VTY_DOC_SET,
CMD_ATTR_IMMEDIATE)
{
+ int rc;
+ struct osmo_tdef *t;
/* If any arguments are missing, redirect to 'show' */
if (argc < 2)
return show_timer(self, vty, argc, argv);
- return osmo_tdef_vty_set_cmd(vty, the_pcu->T_defs, argv);
+ if ((rc = osmo_tdef_vty_set_cmd(vty, the_pcu->T_defs, argv)) != CMD_SUCCESS)
+ return rc;
+ t = osmo_tdef_vty_parse_T_arg(vty, the_pcu->T_defs, argv[0]);
+ switch (t->T) {
+ case PCU_TDEF_NEIGH_CACHE_ALIVE:
+ neigh_cache_set_keep_time_interval(the_pcu->neigh_cache, t->val);
+ break;
+ case PCU_TDEF_SI_CACHE_ALIVE:
+ si_cache_set_keep_time_interval(the_pcu->si_cache, t->val);
+ break;
+ default:
+ break;
+ }
+ return CMD_SUCCESS;
}
DEFUN(show_tbf,
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/22449
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ifa336aa27dd88ff5b78dbc5a2799740f542bb369
Gerrit-Change-Number: 22449
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210126/ac27cfda/attachment.htm>