Skip to content
Snippets Groups Projects
Commit a8046f7d authored by Nevadita's avatar Nevadita Committed by Jakob Olsson
Browse files

Optimizing topology request to all nodes in algo

parent bb1241d6
No related branches found
No related tags found
1 merge request!70Optimizing topology request to all nodes
Pipeline #52451 passed with warnings
......@@ -216,11 +216,11 @@ int topologyd_node_add(struct topologyd_private *priv, struct node *node)
*
* Intial state:
* Nbr(P) = {N0,..Nn} <== immediate neighbors of P.
* G{P, N0,..Nn} <== graph of all known nodes at P.
*
* Step 1:
* for all Ni in G:
* Send Topology Request to Ni.
* (a) Send Topology Request to Ni neighbors
* (b) Send Topology Request to Ni
*
* Step 2:
* Read Topology Response from Ni.
......@@ -233,8 +233,9 @@ int topologyd_node_add(struct topologyd_private *priv, struct node *node)
*/
void topologyd_algo_run(struct topologyd_private *priv)
{
struct node *p;
struct node *p = NULL, *node = NULL;
int i, j;
int is_selfnode = 0;
//struct linkMetricQueryTLV tlv_metric;
if (priv->algo_running)
......@@ -254,17 +255,18 @@ void topologyd_algo_run(struct topologyd_private *priv)
dbg("The total nodes are %d", p->nbr_num);
for (j = 0; j < p->nbr_num; j++) {
dbg("sending req to " MACFMT "\n", MAC2STR(p->nbr_list[j].nbr_macid));
topologyd_send_ieee1905_topology_query(priv, p->nbr_list[j].nbr_macid);
dbg("Processing " MACFMT " AL\n", MAC2STR(p->nbr_list[j].nbr_macid));
/*Here we need to see if the node exist in our hash table then req will
* be sent from below */
node = node_lookup(priv->topo.node_htable, p->nbr_list[j].nbr_macid);
if (!node) {
dbg("sending req to " MACFMT "\n", MAC2STR(p->nbr_list[j].nbr_macid));
topologyd_send_ieee1905_topology_query(priv, p->nbr_list[j].nbr_macid);
dbg("Processing " MACFMT " AL\n", MAC2STR(p->nbr_list[j].nbr_macid));
}
}
/*here we send the topology query to selfnode each*/
/*time the algo runs to keep self node updated */
topologyd_send_ieee1905_topology_query(priv, NULL);
//TEST
//topologyd_send_ieee1905_query(priv, NULL, CMDU_TYPE_HIGHER_LAYER_RESPONSE, NULL);
//topologyd_send_ieee1905_query(priv, NULL, CMDU_TYPE_LINK_METRIC_RESPONSE, NULL);
//TEST
for (i = 0; i < NODE_HTABLE_SIZE; i++) {
if (hlist_empty(&priv->topo.node_htable[i]))
continue;
......@@ -275,8 +277,13 @@ void topologyd_algo_run(struct topologyd_private *priv)
continue;
for (j = 0; j < p->nbr_num; j++) {
dbg("sending req to " MACFMT "\n", MAC2STR(p->nbr_list[j].nbr_macid));
topologyd_send_ieee1905_topology_query(priv, p->nbr_list[j].nbr_macid);
node = NULL;
is_selfnode = memcmp(&priv->selfnode, p->nbr_list[j].nbr_macid, 6);
node = node_lookup(priv->topo.node_htable, p->nbr_list[j].nbr_macid);
if (!node && is_selfnode) {
dbg("sending req to " MACFMT "\n", MAC2STR(p->nbr_list[j].nbr_macid));
topologyd_send_ieee1905_topology_query(priv, p->nbr_list[j].nbr_macid);
}
}
//Here we also need to send the topology query to neighbors
dbg("sending topology req to " MACFMT "\n", MAC2STR(p->hwaddr));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment