node: move roam-events to dedicated struct

Move the roam event counters to a dedicated struct.

Update the ubus output to represent this new organization.

Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
David Bauer
2021-11-26 01:36:43 +01:00
parent edbe7d41dd
commit e51ea7ac1a
5 changed files with 15 additions and 9 deletions

View File

@@ -163,7 +163,7 @@ usteer_local_node_assoc_update(struct sta_info *si, struct blob_attr *data)
continue; continue;
if (current_time - remote_si->last_connected < config.roam_process_timeout) { if (current_time - remote_si->last_connected < config.roam_process_timeout) {
rn->node.roam_source++; rn->node.roam_events.source++;
/* Don't abort looking for roam sources here. /* Don't abort looking for roam sources here.
* The client might have roamed via another node * The client might have roamed via another node
* within the roam-timeout. * within the roam-timeout.

4
node.c
View File

@@ -60,8 +60,8 @@ usteer_node_higher_roamability(struct usteer_node *node, struct usteer_node *ref
{ {
uint64_t roamability_node, roamability_ref; uint64_t roamability_node, roamability_ref;
roamability_node = ((uint64_t)(node->roam_source + node->roam_destination)) * current_time / ((current_time - node->created) + 1); roamability_node = ((uint64_t)(node->roam_events.source + node->roam_events.target)) * current_time / ((current_time - node->created) + 1);
roamability_ref = ((uint64_t)(ref->roam_source + ref->roam_destination)) * current_time / ((current_time - ref->created) + 1); roamability_ref = ((uint64_t)(ref->roam_events.source + ref->roam_events.target)) * current_time / ((current_time - ref->created) + 1);
if (roamability_node < roamability_ref) if (roamability_node < roamability_ref)
return ref; return ref;

View File

@@ -193,7 +193,7 @@ interface_add_station(struct usteer_remote_node *node, struct blob_attr *data)
continue; continue;
if (current_time - local_si->last_connected < config.roam_process_timeout) { if (current_time - local_si->last_connected < config.roam_process_timeout) {
node->node.roam_destination++; node->node.roam_events.target++;
break; break;
} }
} }

10
ubus.c
View File

@@ -274,7 +274,7 @@ usteer_ubus_set_config(struct ubus_context *ctx, struct ubus_object *obj,
void usteer_dump_node(struct blob_buf *buf, struct usteer_node *node) void usteer_dump_node(struct blob_buf *buf, struct usteer_node *node)
{ {
void *c; void *c, *roam_events;
c = blobmsg_open_table(buf, usteer_node_name(node)); c = blobmsg_open_table(buf, usteer_node_name(node));
blobmsg_printf(buf, "bssid", MAC_ADDR_FMT, MAC_ADDR_DATA(node->bssid)); blobmsg_printf(buf, "bssid", MAC_ADDR_FMT, MAC_ADDR_DATA(node->bssid));
@@ -283,8 +283,12 @@ void usteer_dump_node(struct blob_buf *buf, struct usteer_node *node)
blobmsg_add_u32(buf, "noise", node->noise); blobmsg_add_u32(buf, "noise", node->noise);
blobmsg_add_u32(buf, "load", node->load); blobmsg_add_u32(buf, "load", node->load);
blobmsg_add_u32(buf, "max_assoc", node->max_assoc); blobmsg_add_u32(buf, "max_assoc", node->max_assoc);
blobmsg_add_u32(buf, "roam_source", node->roam_source);
blobmsg_add_u32(buf, "roam_destination", node->roam_destination); roam_events = blobmsg_open_table(buf, "roam_events");
blobmsg_add_u32(buf, "source", node->roam_events.source);
blobmsg_add_u32(buf, "target", node->roam_events.target);
blobmsg_close_table(buf, roam_events);
if (node->rrm_nr) if (node->rrm_nr)
blobmsg_add_field(buf, BLOBMSG_TYPE_ARRAY, "rrm_nr", blobmsg_add_field(buf, BLOBMSG_TYPE_ARRAY, "rrm_nr",
blobmsg_data(node->rrm_nr), blobmsg_data(node->rrm_nr),

View File

@@ -88,8 +88,10 @@ struct usteer_node {
int max_assoc; int max_assoc;
int load; int load;
int roam_source; struct {
int roam_destination; int source;
int target;
} roam_events;
uint64_t created; uint64_t created;
}; };