From 3d866d1e4f7c6cf1e976fd7f8561ad9aac6df60d Mon Sep 17 00:00:00 2001 From: Filip Matusiak <filip.matusiak@iopsys.eu> Date: Wed, 11 Dec 2024 14:03:14 +0100 Subject: [PATCH] Get rid of MAC_ENTRY_BSTA and lookup fallback --- src/allmac.c | 2 -- src/allmac.h | 3 +-- src/cntlr.c | 29 ++++++++--------------------- 3 files changed, 9 insertions(+), 25 deletions(-) diff --git a/src/allmac.c b/src/allmac.c index 8417ed15..1f17fe92 100644 --- a/src/allmac.c +++ b/src/allmac.c @@ -38,8 +38,6 @@ const char *allmac_type2str(enum allmac_type type) switch (type) { case MAC_ENTRY_FBSS: return "fbss"; - case MAC_ENTRY_BSTA: - return "bsta"; case MAC_ENTRY_ALID: return "alid"; case MAC_ENTRY_RADIO: diff --git a/src/allmac.h b/src/allmac.h index d1b6232c..95739db0 100644 --- a/src/allmac.h +++ b/src/allmac.h @@ -14,10 +14,9 @@ enum allmac_type { MAC_ENTRY_UNKNOWN = 0, /**< type unset or unknown */ MAC_ENTRY_FBSS, /**< fronthaul iface MAC */ - MAC_ENTRY_BSTA, /**< backhaul STA MAC */ MAC_ENTRY_ALID, /**< node alid MAC */ MAC_ENTRY_RADIO, /**< radio MAC */ - MAC_ENTRY_STA, /**< normal STA MAC */ + MAC_ENTRY_STA, /**< (b)STA MAC */ _MAC_ENTRY_MAX }; diff --git a/src/cntlr.c b/src/cntlr.c index c9a5af95..a03304ae 100644 --- a/src/cntlr.c +++ b/src/cntlr.c @@ -302,19 +302,12 @@ struct sta *cntlr_find_sta(struct controller *c, uint8_t *mac) struct map_macaddr_entry *entry = NULL; struct sta *res; - entry = allmac_lookup(&c->mac_table, mac, MAC_ENTRY_BSTA); - if (!entry) - entry = allmac_lookup(&c->mac_table, mac, MAC_ENTRY_STA); - - if (WARN_ON(!entry)) { - /* fall back to old find - TODO: deprecate */ - res = _cntlr_find_sta(c, mac); - } else { - res = (struct sta*)entry->data; - } + entry = allmac_lookup(&c->mac_table, mac, MAC_ENTRY_STA); + if (WARN_ON(!entry)) + return NULL; - if (res) - time(&res->lookup_time); + res = (struct sta*)entry->data; + time(&res->lookup_time); return res; } @@ -1107,15 +1100,12 @@ void cntlr_toggle_sta_type(struct controller *c, struct sta *s) s->type = was_bsta ? NON_IEEE1905 : IEEE1905; /* add entry with new type */ - allmac_insert(&c->mac_table, s->de_sta->macaddr, - was_bsta ? MAC_ENTRY_STA : MAC_ENTRY_BSTA, - (void *)s); + allmac_insert(&c->mac_table, s->de_sta->macaddr, MAC_ENTRY_STA, (void *)s); } static void node_remove_sta(struct controller *c, struct node *n, struct sta *s) { - enum device_type type = s->type; uint8_t macaddr[6]; memcpy(macaddr, s->de_sta->macaddr, 6); @@ -1129,8 +1119,7 @@ static void node_remove_sta(struct controller *c, struct node *n, n->sta_count--; /* Remove MAC address from lookup table */ - allmac_clean_entry(&c->mac_table, macaddr, - type == NON_IEEE1905 ? MAC_ENTRY_STA : MAC_ENTRY_BSTA); + allmac_clean_entry(&c->mac_table, macaddr, MAC_ENTRY_STA); } struct sta *cntlr_add_sta(struct controller *c, struct node *n, @@ -1189,9 +1178,7 @@ struct sta *cntlr_add_sta(struct controller *c, struct node *n, INIT_LIST_HEAD(&s->umetriclist); list_add(&s->list, &n->stalist); n->sta_count++; - allmac_insert(&c->mac_table, macaddr, - is_bsta ? MAC_ENTRY_BSTA : MAC_ENTRY_STA, - (void *)s); + allmac_insert(&c->mac_table, macaddr, MAC_ENTRY_STA, (void *)s); timer_init(&s->bcn_metrics_timer, cntlr_bcn_metrics_parse); timer_init(&s->btm_req_timer, cntlr_btm_req_timer_cb); -- GitLab