Skip to main content
Sign in
Snippets Groups Projects
Commit ccdef96e authored by Anjan Chanda's avatar Anjan Chanda
Browse files

get estimate of max throughput for a node

parent 0f0b5512
Branches
No related tags found
No related merge requests found
...@@ -746,6 +746,43 @@ struct node *cntlr_alloc_node(struct controller *c, uint8_t *almacaddr) ...@@ -746,6 +746,43 @@ struct node *cntlr_alloc_node(struct controller *c, uint8_t *almacaddr)
return n; return n;
} }
uint32_t cntlr_estimate_max_thput_for_node(struct controller *c, uint8_t *node_almacaddr)
{
uint32_t est_thput = 0xffffffff;
const struct backhaul_info *b = NULL;
const struct bh_topology_dev *dev;
dev = topology_find_device(&c->topology, node_almacaddr);
if (!dev)
return est_thput;
while (dev->bh.parent) {
b = &dev->bh;
if (b->own_iface) {
bool is_wifi = !!(b->own_iface->media_type & 0x0100);
struct sta *s = NULL;
if (!is_wifi) {
dev = b->parent;
continue;
}
s = cntlr_find_sta(c->sta_table, (uint8_t *)b->own_iface->macaddr);
if (s && s->is_bsta && s->de_sta) {
if (s->de_sta->dl_est_thput < est_thput)
est_thput = s->de_sta->dl_est_thput;
}
}
dev = b->parent;
}
if (est_thput != 0xffffffff)
est_thput /= 2; /* TODO: MLO link */
return est_thput;
}
void cntlr_clean_bcnreqlist(struct controller *c) void cntlr_clean_bcnreqlist(struct controller *c)
{ {
dbg("%s: --->\n", __func__); dbg("%s: --->\n", __func__);
...@@ -1691,6 +1728,19 @@ static void cntlr_periodic_run(atimer_t *t) ...@@ -1691,6 +1728,19 @@ static void cntlr_periodic_run(atimer_t *t)
if ((c->uptime % METRIC_REP_INTERVAL) == 0) if ((c->uptime % METRIC_REP_INTERVAL) == 0)
cntlr_metric_collection(c); cntlr_metric_collection(c);
#if 1 //TODO: move from here
if (c->uptime % 7 == 0) {
struct node *n = NULL;
list_for_each_entry(n, &c->nodelist, list) {
uint32_t est_thput = cntlr_estimate_max_thput_for_node(c, n->almacaddr);
cntlr_info(LOG_DEFAULT, "** Node = " MACFMT ": est-throughput = %d\n",
MAC2STR(n->almacaddr), est_thput);
n->est_thput_dl = est_thput;
}
}
#endif
cntlr_ageout_nodes(c); cntlr_ageout_nodes(c);
cntlr_remove_stale_sta(c); cntlr_remove_stale_sta(c);
timer_set(&c->heartbeat, 1 * 1000); timer_set(&c->heartbeat, 1 * 1000);
... ...
......
...@@ -231,6 +231,8 @@ struct node { ...@@ -231,6 +231,8 @@ struct node {
enum nodetype type; enum nodetype type;
int depth; /** >= 0 or -1 for unknown */ int depth; /** >= 0 or -1 for unknown */
int ul_type; /** uplink type */ int ul_type; /** uplink type */
uint32_t est_thput_ul; /* estimated l3 throughput achievable in uplink dir */
uint32_t est_thput_dl; /* estimated l3 throughput achievable in downlink dir */
bool scan_supported; /** whether scanning supported */ bool scan_supported; /** whether scanning supported */
struct controller *cntlr; struct controller *cntlr;
#define MAX_UOBJECTS 8 #define MAX_UOBJECTS 8
...@@ -444,5 +446,7 @@ void cntlr_qos_sync_node(struct controller *c, ...@@ -444,5 +446,7 @@ void cntlr_qos_sync_node(struct controller *c,
uint8_t *origin); uint8_t *origin);
#endif /* EASYMESH_VERSION > 2 */ #endif /* EASYMESH_VERSION > 2 */
/* Estimate max-throughput achievable for an EasyMesh 'node' */
uint32_t cntlr_estimate_max_thput_for_node(struct controller *c, uint8_t *node_almacaddr);
#endif /* CNTLR_H */ #endif /* CNTLR_H */
...@@ -2102,6 +2102,14 @@ int handle_ap_metrics_response(void *cntlr, struct cmdu_buff *cmdu, struct node ...@@ -2102,6 +2102,14 @@ int handle_ap_metrics_response(void *cntlr, struct cmdu_buff *cmdu, struct node
s->de_sta->dl_est_thput = dl_est_thput; s->de_sta->dl_est_thput = dl_est_thput;
s->de_sta->ul_est_thput = ul_est_thput; s->de_sta->ul_est_thput = ul_est_thput;
s->de_sta->rcpi = rcpi; s->de_sta->rcpi = rcpi;
if (s->is_bsta) {
uint32_t est_thput = cntlr_estimate_max_thput_for_node(c, n->almacaddr);
cntlr_info(LOG_DEFAULT, "Node = " MACFMT ": est-throughput = %d\n",
MAC2STR(n->almacaddr), est_thput);
n->est_thput_dl = est_thput;
}
} }
} }
... ...
......
...@@ -365,7 +365,7 @@ static bool set_device_child_neighbors(struct bh_topology_data *topology, ...@@ -365,7 +365,7 @@ static bool set_device_child_neighbors(struct bh_topology_data *topology,
child_neighbor_dev->bh.own_iface = child_iface; child_neighbor_dev->bh.own_iface = child_iface;
if (child_iface && (child_iface->media_type != parent_iface->media_type)) { if (child_iface && (is_wifi(child_iface->media_type) != is_wifi(parent_iface->media_type))) {
warn("BH:%s: child and parent iface media type differs, parent: %s, child: %s\n", warn("BH:%s: child and parent iface media type differs, parent: %s, child: %s\n",
i1905_media_type_to_str(parent_iface->media_type), i1905_media_type_to_str(parent_iface->media_type),
i1905_media_type_to_str(child_iface->media_type), i1905_media_type_to_str(child_iface->media_type),
...@@ -373,7 +373,7 @@ static bool set_device_child_neighbors(struct bh_topology_data *topology, ...@@ -373,7 +373,7 @@ static bool set_device_child_neighbors(struct bh_topology_data *topology,
} }
dbg("BH: %s New parent-child link set:\n", __func__); dbg("BH: %s New parent-child link set:\n", __func__);
dbg_dump_bh_topo_link(child_neighbor_dev, INDENT_LVL_0); //dbg_dump_bh_topo_link(child_neighbor_dev, INDENT_LVL_0);
has_child_neighbor = true; has_child_neighbor = true;
} }
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment