Lines Matching full:node
43 struct hsr_node *node; in hsr_addr_is_self() local
45 node = list_first_or_null_rcu(&hsr->self_node_db, struct hsr_node, in hsr_addr_is_self()
47 if (!node) { in hsr_addr_is_self()
48 WARN_ONCE(1, "HSR: No self node\n"); in hsr_addr_is_self()
52 if (ether_addr_equal(addr, node->macaddress_A)) in hsr_addr_is_self()
54 if (ether_addr_equal(addr, node->macaddress_B)) in hsr_addr_is_self()
65 struct hsr_node *node; in find_node_by_addr_A() local
67 list_for_each_entry_rcu(node, node_db, mac_list) { in find_node_by_addr_A()
68 if (ether_addr_equal(node->macaddress_A, addr)) in find_node_by_addr_A()
69 return node; in find_node_by_addr_A()
83 struct hsr_node *node, *oldnode; in hsr_create_self_node() local
85 node = kmalloc(sizeof(*node), GFP_KERNEL); in hsr_create_self_node()
86 if (!node) in hsr_create_self_node()
89 ether_addr_copy(node->macaddress_A, addr_a); in hsr_create_self_node()
90 ether_addr_copy(node->macaddress_B, addr_b); in hsr_create_self_node()
96 list_replace_rcu(&oldnode->mac_list, &node->mac_list); in hsr_create_self_node()
100 list_add_tail_rcu(&node->mac_list, self_node_db); in hsr_create_self_node()
110 struct hsr_node *node; in hsr_del_self_node() local
113 node = list_first_or_null_rcu(self_node_db, struct hsr_node, mac_list); in hsr_del_self_node()
114 if (node) { in hsr_del_self_node()
115 list_del_rcu(&node->mac_list); in hsr_del_self_node()
116 kfree_rcu(node, rcu_head); in hsr_del_self_node()
123 struct hsr_node *node; in hsr_del_nodes() local
126 list_for_each_entry_safe(node, tmp, node_db, mac_list) in hsr_del_nodes()
127 kfree(node); in hsr_del_nodes()
131 struct hsr_node *node) in prp_handle_san_frame() argument
133 /* Mark if the SAN node is over LAN_A or LAN_B */ in prp_handle_san_frame()
135 node->san_a = true; in prp_handle_san_frame()
140 node->san_b = true; in prp_handle_san_frame()
143 /* Allocate an hsr_node and add it to node_db. 'addr' is the node's address_A;
145 * originating from the newly added node.
153 struct hsr_node *new_node, *node; in hsr_add_node() local
179 list_for_each_entry_rcu(node, node_db, mac_list, in hsr_add_node()
181 if (ether_addr_equal(node->macaddress_A, addr)) in hsr_add_node()
183 if (ether_addr_equal(node->macaddress_B, addr)) in hsr_add_node()
192 return node; in hsr_add_node()
195 void prp_update_san_info(struct hsr_node *node, bool is_sup) in prp_update_san_info() argument
200 node->san_a = false; in prp_update_san_info()
201 node->san_b = false; in prp_update_san_info()
211 struct hsr_node *node; in hsr_get_node() local
222 list_for_each_entry_rcu(node, node_db, mac_list) { in hsr_get_node()
223 if (ether_addr_equal(node->macaddress_A, ethhdr->h_source)) { in hsr_get_node()
225 hsr->proto_ops->update_san_info(node, is_sup); in hsr_get_node()
226 return node; in hsr_get_node()
228 if (ether_addr_equal(node->macaddress_B, ethhdr->h_source)) { in hsr_get_node()
230 hsr->proto_ops->update_san_info(node, is_sup); in hsr_get_node()
231 return node; in hsr_get_node()
235 /* Everyone may create a node entry, connected node to a HSR/PRP in hsr_get_node()
261 * node.
304 /* No frame received from AddrA of this node yet */ in hsr_handle_sup_frame()
311 /* Node has already been merged */ in hsr_handle_sup_frame()
344 * If the frame was sent by a node's B interface, replace the source
345 * address with that node's "official" address (macaddress_A) so that upper
348 void hsr_addr_subst_source(struct hsr_node *node, struct sk_buff *skb) in hsr_addr_subst_source() argument
355 memcpy(ð_hdr(skb)->h_source, node->macaddress_A, ETH_ALEN); in hsr_addr_subst_source()
384 netdev_err(skb->dev, "%s: Unknown node\n", __func__); in hsr_addr_subst_dest()
394 void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port, in hsr_register_frame_in() argument
401 if (seq_nr_before(sequence_nr, node->seq_out[port->type])) in hsr_register_frame_in()
404 node->time_in[port->type] = jiffies; in hsr_register_frame_in()
405 node->time_in_stale[port->type] = false; in hsr_register_frame_in()
416 int hsr_register_frame_out(struct hsr_port *port, struct hsr_node *node, in hsr_register_frame_out() argument
419 spin_lock_bh(&node->seq_out_lock); in hsr_register_frame_out()
420 if (seq_nr_before_or_eq(sequence_nr, node->seq_out[port->type]) && in hsr_register_frame_out()
421 time_is_after_jiffies(node->time_out[port->type] + in hsr_register_frame_out()
423 spin_unlock_bh(&node->seq_out_lock); in hsr_register_frame_out()
427 node->time_out[port->type] = jiffies; in hsr_register_frame_out()
428 node->seq_out[port->type] = sequence_nr; in hsr_register_frame_out()
429 spin_unlock_bh(&node->seq_out_lock); in hsr_register_frame_out()
434 struct hsr_node *node) in get_late_port() argument
436 if (node->time_in_stale[HSR_PT_SLAVE_A]) in get_late_port()
438 if (node->time_in_stale[HSR_PT_SLAVE_B]) in get_late_port()
441 if (time_after(node->time_in[HSR_PT_SLAVE_B], in get_late_port()
442 node->time_in[HSR_PT_SLAVE_A] + in get_late_port()
445 if (time_after(node->time_in[HSR_PT_SLAVE_A], in get_late_port()
446 node->time_in[HSR_PT_SLAVE_B] + in get_late_port()
459 struct hsr_node *node; in hsr_prune_nodes() local
466 list_for_each_entry_safe(node, tmp, &hsr->node_db, mac_list) { in hsr_prune_nodes()
467 /* Don't prune own node. Neither time_in[HSR_PT_SLAVE_A] in hsr_prune_nodes()
469 * the master port. Thus the master node will be repeatedly in hsr_prune_nodes()
472 if (hsr_addr_is_self(hsr, node->macaddress_A)) in hsr_prune_nodes()
476 time_a = node->time_in[HSR_PT_SLAVE_A]; in hsr_prune_nodes()
477 time_b = node->time_in[HSR_PT_SLAVE_B]; in hsr_prune_nodes()
481 node->time_in_stale[HSR_PT_SLAVE_A] = true; in hsr_prune_nodes()
483 node->time_in_stale[HSR_PT_SLAVE_B] = true; in hsr_prune_nodes()
485 /* Get age of newest frame from node. in hsr_prune_nodes()
490 if (node->time_in_stale[HSR_PT_SLAVE_A] || in hsr_prune_nodes()
491 (!node->time_in_stale[HSR_PT_SLAVE_B] && in hsr_prune_nodes()
499 port = get_late_port(hsr, node); in hsr_prune_nodes()
501 hsr_nl_ringerror(hsr, node->macaddress_A, port); in hsr_prune_nodes()
508 hsr_nl_nodedown(hsr, node->macaddress_A); in hsr_prune_nodes()
509 list_del_rcu(&node->mac_list); in hsr_prune_nodes()
511 kfree_rcu(node, rcu_head); in hsr_prune_nodes()
524 struct hsr_node *node; in hsr_get_next_node() local
527 node = list_first_or_null_rcu(&hsr->node_db, in hsr_get_next_node()
529 if (node) in hsr_get_next_node()
530 ether_addr_copy(addr, node->macaddress_A); in hsr_get_next_node()
531 return node; in hsr_get_next_node()
534 node = _pos; in hsr_get_next_node()
535 list_for_each_entry_continue_rcu(node, &hsr->node_db, mac_list) { in hsr_get_next_node()
536 ether_addr_copy(addr, node->macaddress_A); in hsr_get_next_node()
537 return node; in hsr_get_next_node()
552 struct hsr_node *node; in hsr_get_node_data() local
556 node = find_node_by_addr_A(&hsr->node_db, addr); in hsr_get_node_data()
557 if (!node) in hsr_get_node_data()
560 ether_addr_copy(addr_b, node->macaddress_B); in hsr_get_node_data()
562 tdiff = jiffies - node->time_in[HSR_PT_SLAVE_A]; in hsr_get_node_data()
563 if (node->time_in_stale[HSR_PT_SLAVE_A]) in hsr_get_node_data()
572 tdiff = jiffies - node->time_in[HSR_PT_SLAVE_B]; in hsr_get_node_data()
573 if (node->time_in_stale[HSR_PT_SLAVE_B]) in hsr_get_node_data()
583 *if1_seq = node->seq_out[HSR_PT_SLAVE_B]; in hsr_get_node_data()
584 *if2_seq = node->seq_out[HSR_PT_SLAVE_A]; in hsr_get_node_data()
586 if (node->addr_B_port != HSR_PT_NONE) { in hsr_get_node_data()
587 port = hsr_port_get_hsr(hsr, node->addr_B_port); in hsr_get_node_data()