NACC: allow setting keep time for entries in neigh and si cache

Related: SYS#4909
Change-Id: Ifa336aa27dd88ff5b78dbc5a2799740f542bb369
This commit is contained in:
Pau Espin 2021-01-26 17:51:44 +01:00
parent c0805e6389
commit ab7159f6ec
5 changed files with 45 additions and 15 deletions

View File

@ -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;
}

View File

@ -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 */

View File

@ -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)

View File

@ -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);

View File

@ -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,