aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-01-26 17:51:44 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2021-01-29 12:59:30 +0100
commitab7159f6ecda4a3f6d578315549de8895ec4fc5a (patch)
treebcbe75d263c5cf12669a3fd41656866db8ab51f6 /src
parentc0805e63895f40b2cb84801fa162794b8229ec5c (diff)
NACC: allow setting keep time for entries in neigh and si cache
Diffstat (limited to 'src')
-rw-r--r--src/gprs_pcu.c6
-rw-r--r--src/gprs_pcu.h3
-rw-r--r--src/neigh_cache.c28
-rw-r--r--src/neigh_cache.h6
-rw-r--r--src/pcu_vty.c17
5 files changed, 45 insertions, 15 deletions
diff --git a/src/gprs_pcu.c b/src/gprs_pcu.c
index 9a21cdb4..31ed8b71 100644
--- a/src/gprs_pcu.c
+++ b/src/gprs_pcu.c
@@ -33,6 +33,8 @@ static struct osmo_tdef T_defs_pcu[] = {
{ .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 @@ struct gprs_pcu *gprs_pcu_alloc(void *ctx)
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 8e18f89e..4f22f68b 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 a4bdfbeb..ae619d3b 100644
--- a/src/neigh_cache.c
+++ b/src/neigh_cache.c
@@ -27,10 +27,6 @@
#include <neigh_cache.h>
#include <gprs_debug.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 inline bool neigh_cache_entry_key_eq(const struct neigh_cache_entry_key *a,
const struct neigh_cache_entry_key *b)
{
@@ -89,16 +85,23 @@ static void neigh_cache_schedule_cleanup(struct neigh_cache *cache)
osmo_timer_schedule(&cache->cleanup_timer, result.tv_sec, result.tv_nsec*1000);
}
-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);
OSMO_ASSERT(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)
@@ -168,8 +171,6 @@ void neigh_cache_free(struct neigh_cache *cache)
// 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)
{
@@ -218,15 +219,22 @@ static void si_cache_schedule_cleanup(struct si_cache *cache)
osmo_timer_schedule(&cache->cleanup_timer, result.tv_sec, result.tv_nsec*1000);
}
-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);
OSMO_ASSERT(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 3fd56b7a..4fed0faf 100644
--- a/src/neigh_cache.h
+++ b/src/neigh_cache.h
@@ -55,7 +55,8 @@ struct neigh_cache_entry {
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);
@@ -90,7 +91,8 @@ struct si_cache_entry {
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 8f97f306..b0d1ac60 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -1064,10 +1064,25 @@ DEFUN_ATTR(cfg_pcu_timer, cfg_pcu_timer_cmd,
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,