Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions band_steering.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,41 @@ void usteer_band_steering_sta_update(struct sta_info *si)
si->band_steering.below_snr = true;
}

bool usteer_band_steering_is_target(struct usteer_local_node *ln, struct usteer_node *node)
static bool band_steering_is_target(struct usteer_node *cur, struct usteer_node *new)
{
if (&ln->node == node)
if (cur == new)
return false;

if (strcmp(ln->node.ssid, node->ssid))
if (strcmp(cur->ssid, new->ssid))
return false;

if (node->freq < 4000)
if (new->freq < 4000)
return false;

if (!usteer_policy_node_below_max_assoc(node))
if (!usteer_policy_node_below_max_assoc(new))
return false;

/* ToDo: Skip nodes with active load-kick */

return true;
}
}

bool usteer_band_steering_is_target(struct usteer_local_node *ln, struct usteer_node *node)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure the rationale for usteer_band_steering_is_target to accept a local node, since it only access the fields within struct usteer_node.

{
return band_steering_is_target(&ln->node, node);
}

/* Checks if the configuration will band steer from the current station to the new one */
bool usteer_will_band_steer(struct sta_info *si_cur, struct sta_info *si_new)
{
if (!config.band_steering_interval)
return false;

if (si_cur->node->freq >= 4000)
return false;

return band_steering_is_target(si_cur->node, si_new->node);
}

static bool usteer_band_steering_has_target_iface(struct usteer_local_node *ln)
{
Expand Down Expand Up @@ -96,4 +112,4 @@ void usteer_band_steering_perform_steer(struct usteer_local_node *ln)

si->band_steering.below_snr = false;
}
}
}
6 changes: 4 additions & 2 deletions policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ is_better_candidate(struct sta_info *si_cur, struct sta_info *si_new)
!below_assoc_threshold(new_node, current_node))
reasons |= (1 << UEV_SELECT_REASON_NUM_ASSOC);

if (better_signal_strength(current_signal, new_signal))
/* If band steering will bounce us back, ignore comparing the signal (note flipped si_new, si_cur) */
if (!usteer_will_band_steer(si_new, si_cur) &&
better_signal_strength(current_signal, new_signal))
reasons |= (1 << UEV_SELECT_REASON_SIGNAL);

if (has_better_load(current_node, new_node) &&
Expand Down Expand Up @@ -146,7 +148,7 @@ find_better_candidate(struct sta_info *si_ref, struct uevent *ev, uint32_t requi
ev->select_reasons = reasons;
}

if (!candidate || si->signal > candidate->signal)
if (!candidate || (is_better_candidate(candidate, si) && si->signal > candidate->signal))
candidate = si;
}

Expand Down
1 change: 1 addition & 0 deletions usteer.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ bool usteer_policy_can_perform_roam(struct sta_info *si);
void usteer_band_steering_perform_steer(struct usteer_local_node *ln);
void usteer_band_steering_sta_update(struct sta_info *si);
bool usteer_band_steering_is_target(struct usteer_local_node *ln, struct usteer_node *node);
bool usteer_will_band_steer(struct sta_info *si_cur, struct sta_info *si_new);

void usteer_ubus_init(struct ubus_context *ctx);
void usteer_ubus_kick_client(struct sta_info *si);
Expand Down