Lines Matching refs:gw_node

59  * batadv_gw_node_release() - release gw_node from lists and queue for free
61 * @ref: kref pointer of the gw_node
65 struct batadv_gw_node *gw_node;
67 gw_node = container_of(ref, struct batadv_gw_node, refcount);
69 batadv_orig_node_put(gw_node->orig_node);
70 kfree_rcu(gw_node, rcu);
82 struct batadv_gw_node *gw_node;
85 gw_node = rcu_dereference(bat_priv->gw.curr_gw);
86 if (!gw_node)
89 if (!kref_get_unless_zero(&gw_node->refcount))
90 gw_node = NULL;
94 return gw_node;
106 struct batadv_gw_node *gw_node;
109 gw_node = batadv_gw_get_selected_gw_node(bat_priv);
110 if (!gw_node)
114 orig_node = gw_node->orig_node;
124 if (gw_node)
125 batadv_gw_node_put(gw_node);
336 struct batadv_gw_node *gw_node;
343 gw_node = kzalloc(sizeof(*gw_node), GFP_ATOMIC);
344 if (!gw_node)
347 kref_init(&gw_node->refcount);
348 INIT_HLIST_NODE(&gw_node->list);
350 gw_node->orig_node = orig_node;
351 gw_node->bandwidth_down = ntohl(gateway->bandwidth_down);
352 gw_node->bandwidth_up = ntohl(gateway->bandwidth_up);
354 kref_get(&gw_node->refcount);
355 hlist_add_head_rcu(&gw_node->list, &bat_priv->gw.gateway_list);
366 /* don't return reference to new gw_node */
367 batadv_gw_node_put(gw_node);
380 struct batadv_gw_node *gw_node_tmp, *gw_node = NULL;
391 gw_node = gw_node_tmp;
396 return gw_node;
410 struct batadv_gw_node *gw_node, *curr_gw = NULL;
413 gw_node = batadv_gw_node_get(bat_priv, orig_node);
414 if (!gw_node) {
421 if (gw_node->bandwidth_down == ntohl(gateway->bandwidth_down) &&
422 gw_node->bandwidth_up == ntohl(gateway->bandwidth_up))
428 gw_node->bandwidth_down / 10,
429 gw_node->bandwidth_down % 10,
430 gw_node->bandwidth_up / 10,
431 gw_node->bandwidth_up % 10,
437 gw_node->bandwidth_down = ntohl(gateway->bandwidth_down);
438 gw_node->bandwidth_up = ntohl(gateway->bandwidth_up);
449 if (!hlist_unhashed(&gw_node->list)) {
450 hlist_del_init_rcu(&gw_node->list);
451 batadv_gw_node_put(gw_node);
457 if (gw_node == curr_gw)
465 if (gw_node)
466 batadv_gw_node_put(gw_node);
491 struct batadv_gw_node *gw_node;
495 hlist_for_each_entry_safe(gw_node, node_tmp,
497 hlist_del_init_rcu(&gw_node->list);
498 batadv_gw_node_put(gw_node);
738 struct batadv_gw_node *gw_node = NULL;
756 gw_node = batadv_gw_node_get(bat_priv, orig_dst_node);
757 if (!gw_node)
816 if (gw_node)
817 batadv_gw_node_put(gw_node);