aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2015-11-25 16:45:59 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2015-12-03 11:39:57 +0100
commit2c8b58139f3e3c29309dd6518f77a62414de560c (patch)
tree148c83d83fd92275a3988127ee8c887ed47cbb9d
parent1aa0e47104d9529ecf448b81adb9ef6fb0a50c5f (diff)
gtphub: cosmetic/prepare: rename expiry queues.
The expiry queues are already used for resolved GGSN addresses, and will soon enlist tunnel structs. Hence the naming should be more general. Sponsored-by: On-Waves ehi
-rw-r--r--openbsc/include/openbsc/gtphub.h8
-rw-r--r--openbsc/src/gprs/gtphub.c19
2 files changed, 13 insertions, 14 deletions
diff --git a/openbsc/include/openbsc/gtphub.h b/openbsc/include/openbsc/gtphub.h
index 07af039aa..f2130844a 100644
--- a/openbsc/include/openbsc/gtphub.h
+++ b/openbsc/include/openbsc/gtphub.h
@@ -329,8 +329,8 @@ int nr_map_empty(const struct nr_map *map);
/* config */
-static const int GTPH_SEQ_MAPPING_EXPIRY_SECS = 30; /* TODO is there a spec for this? */
-static const int GTPH_TEI_MAPPING_EXPIRY_MINUTES = 6 * 60; /* TODO is there a spec for this? */
+static const int GTPH_EXPIRE_QUICKLY_SECS = 30; /* TODO is there a spec for this? */
+static const int GTPH_EXPIRE_SLOWLY_MINUTES = 6 * 60; /* TODO is there a spec for this? */
struct gtphub_cfg_addr {
const char *addr_str;
@@ -423,8 +423,8 @@ struct gtphub {
struct llist_head resolved_ggsns; /* struct gtphub_resolved_ggsn */
struct osmo_timer_list gc_timer;
- struct expiry expire_seq_maps;
- struct expiry expire_tei_maps;
+ struct expiry expire_quickly;
+ struct expiry expire_slowly;
uint16_t restart_counter;
};
diff --git a/openbsc/src/gprs/gtphub.c b/openbsc/src/gprs/gtphub.c
index e339ac69b..4200822aa 100644
--- a/openbsc/src/gprs/gtphub.c
+++ b/openbsc/src/gprs/gtphub.c
@@ -1761,7 +1761,7 @@ void gtphub_resolved_ggsn(struct gtphub *hub, const char *apn_oi_str,
ggsn->apn_oi_str[sizeof(ggsn->apn_oi_str) - 1] = '\0';
ggsn->expiry_entry.del_cb = resolved_gssn_del_cb;
- expiry_add(&hub->expire_tei_maps, &ggsn->expiry_entry, now);
+ expiry_add(&hub->expire_slowly, &ggsn->expiry_entry, now);
llist_add(&ggsn->entry, &hub->resolved_ggsns);
}
@@ -1814,8 +1814,8 @@ static void gtphub_gc_bind(struct gtphub_bind *b)
void gtphub_gc(struct gtphub *hub, time_t now)
{
int expired;
- expired = expiry_tick(&hub->expire_seq_maps, now);
- expired += expiry_tick(&hub->expire_tei_maps, now);
+ expired = expiry_tick(&hub->expire_quickly, now);
+ expired += expiry_tick(&hub->expire_slowly, now);
/* ... */
@@ -1848,16 +1848,15 @@ void gtphub_init(struct gtphub *hub)
{
gtphub_zero(hub);
- expiry_init(&hub->expire_seq_maps, GTPH_SEQ_MAPPING_EXPIRY_SECS);
- expiry_init(&hub->expire_tei_maps,
- GTPH_TEI_MAPPING_EXPIRY_MINUTES * 60);
+ expiry_init(&hub->expire_quickly, GTPH_EXPIRE_QUICKLY_SECS);
+ expiry_init(&hub->expire_slowly, GTPH_EXPIRE_SLOWLY_MINUTES * 60);
int plane_idx;
for (plane_idx = 0; plane_idx < GTPH_PLANE_N; plane_idx++) {
nr_pool_init(&hub->tei_pool[plane_idx], 1, 0xffffffff);
nr_map_init(&hub->tei_map[plane_idx],
&hub->tei_pool[plane_idx],
- &hub->expire_tei_maps);
+ &hub->expire_slowly);
gtphub_bind_init(&hub->to_ggsns[plane_idx]);
gtphub_bind_init(&hub->to_sgsns[plane_idx]);
@@ -1877,8 +1876,8 @@ void gtphub_free(struct gtphub *hub)
/* By expiring all mappings, a garbage collection should free
* everything else. A gtphub_bind_free() will assert that everything is
* indeed empty. */
- expiry_clear(&hub->expire_seq_maps);
- expiry_clear(&hub->expire_tei_maps);
+ expiry_clear(&hub->expire_quickly);
+ expiry_clear(&hub->expire_slowly);
int plane_idx;
for (plane_idx = 0; plane_idx < GTPH_PLANE_N; plane_idx++) {
@@ -2060,7 +2059,7 @@ static struct gtphub_peer *gtphub_peer_new(struct gtphub *hub,
INIT_LLIST_HEAD(&peer->addresses);
nr_pool_init(&peer->seq_pool, 0, 0xffff);
- nr_map_init(&peer->seq_map, &peer->seq_pool, &hub->expire_seq_maps);
+ nr_map_init(&peer->seq_map, &peer->seq_pool, &hub->expire_quickly);
/* TODO use something random to pick the initial sequence nr.
0x6d31 produces the ASCII character sequence 'm1', currently used in