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
176 list_for_each_entry_rcu(node, node_db, mac_list, in hsr_add_node()
178 if (ether_addr_equal(node->macaddress_A, addr)) in hsr_add_node()
180 if (ether_addr_equal(node->macaddress_B, addr)) in hsr_add_node()
189 return node; in hsr_add_node()
192 void prp_update_san_info(struct hsr_node *node, bool is_sup) in prp_update_san_info() argument
197 node->san_a = false; in prp_update_san_info()
198 node->san_b = false; in prp_update_san_info()
208 struct hsr_node *node; in hsr_get_node() local
219 list_for_each_entry_rcu(node, node_db, mac_list) { in hsr_get_node()
220 if (ether_addr_equal(node->macaddress_A, ethhdr->h_source)) { in hsr_get_node()
222 hsr->proto_ops->update_san_info(node, is_sup); in hsr_get_node()
223 return node; in hsr_get_node()
225 if (ether_addr_equal(node->macaddress_B, ethhdr->h_source)) { in hsr_get_node()
227 hsr->proto_ops->update_san_info(node, is_sup); in hsr_get_node()
228 return node; in hsr_get_node()
232 /* Everyone may create a node entry, connected node to a HSR/PRP in hsr_get_node()
258 * node.
301 /* No frame received from AddrA of this node yet */ in hsr_handle_sup_frame()
308 /* Node has already been merged */ in hsr_handle_sup_frame()
339 * If the frame was sent by a node's B interface, replace the source
340 * address with that node's "official" address (macaddress_A) so that upper
343 void hsr_addr_subst_source(struct hsr_node *node, struct sk_buff *skb) in hsr_addr_subst_source() argument
350 memcpy(&eth_hdr(skb)->h_source, node->macaddress_A, ETH_ALEN); in hsr_addr_subst_source()
379 netdev_err(skb->dev, "%s: Unknown node\n", __func__); in hsr_addr_subst_dest()
389 void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port, in hsr_register_frame_in() argument
396 if (seq_nr_before(sequence_nr, node->seq_out[port->type])) in hsr_register_frame_in()
399 node->time_in[port->type] = jiffies; in hsr_register_frame_in()
400 node->time_in_stale[port->type] = false; in hsr_register_frame_in()
411 int hsr_register_frame_out(struct hsr_port *port, struct hsr_node *node, in hsr_register_frame_out() argument
414 if (seq_nr_before_or_eq(sequence_nr, node->seq_out[port->type])) in hsr_register_frame_out()
417 node->seq_out[port->type] = sequence_nr; in hsr_register_frame_out()
422 struct hsr_node *node) in get_late_port() argument
424 if (node->time_in_stale[HSR_PT_SLAVE_A]) in get_late_port()
426 if (node->time_in_stale[HSR_PT_SLAVE_B]) in get_late_port()
429 if (time_after(node->time_in[HSR_PT_SLAVE_B], in get_late_port()
430 node->time_in[HSR_PT_SLAVE_A] + in get_late_port()
433 if (time_after(node->time_in[HSR_PT_SLAVE_A], in get_late_port()
434 node->time_in[HSR_PT_SLAVE_B] + in get_late_port()
447 struct hsr_node *node; in hsr_prune_nodes() local
454 list_for_each_entry_safe(node, tmp, &hsr->node_db, mac_list) { in hsr_prune_nodes()
455 /* Don't prune own node. Neither time_in[HSR_PT_SLAVE_A] in hsr_prune_nodes()
457 * the master port. Thus the master node will be repeatedly in hsr_prune_nodes()
460 if (hsr_addr_is_self(hsr, node->macaddress_A)) in hsr_prune_nodes()
464 time_a = node->time_in[HSR_PT_SLAVE_A]; in hsr_prune_nodes()
465 time_b = node->time_in[HSR_PT_SLAVE_B]; in hsr_prune_nodes()
469 node->time_in_stale[HSR_PT_SLAVE_A] = true; in hsr_prune_nodes()
471 node->time_in_stale[HSR_PT_SLAVE_B] = true; in hsr_prune_nodes()
473 /* Get age of newest frame from node. in hsr_prune_nodes()
478 if (node->time_in_stale[HSR_PT_SLAVE_A] || in hsr_prune_nodes()
479 (!node->time_in_stale[HSR_PT_SLAVE_B] && in hsr_prune_nodes()
487 port = get_late_port(hsr, node); in hsr_prune_nodes()
489 hsr_nl_ringerror(hsr, node->macaddress_A, port); in hsr_prune_nodes()
496 hsr_nl_nodedown(hsr, node->macaddress_A); in hsr_prune_nodes()
497 list_del_rcu(&node->mac_list); in hsr_prune_nodes()
499 kfree_rcu(node, rcu_head); in hsr_prune_nodes()
512 struct hsr_node *node; in hsr_get_next_node() local
515 node = list_first_or_null_rcu(&hsr->node_db, in hsr_get_next_node()
517 if (node) in hsr_get_next_node()
518 ether_addr_copy(addr, node->macaddress_A); in hsr_get_next_node()
519 return node; in hsr_get_next_node()
522 node = _pos; in hsr_get_next_node()
523 list_for_each_entry_continue_rcu(node, &hsr->node_db, mac_list) { in hsr_get_next_node()
524 ether_addr_copy(addr, node->macaddress_A); in hsr_get_next_node()
525 return node; in hsr_get_next_node()
540 struct hsr_node *node; in hsr_get_node_data() local
544 node = find_node_by_addr_A(&hsr->node_db, addr); in hsr_get_node_data()
545 if (!node) in hsr_get_node_data()
548 ether_addr_copy(addr_b, node->macaddress_B); in hsr_get_node_data()
550 tdiff = jiffies - node->time_in[HSR_PT_SLAVE_A]; in hsr_get_node_data()
551 if (node->time_in_stale[HSR_PT_SLAVE_A]) in hsr_get_node_data()
560 tdiff = jiffies - node->time_in[HSR_PT_SLAVE_B]; in hsr_get_node_data()
561 if (node->time_in_stale[HSR_PT_SLAVE_B]) in hsr_get_node_data()
571 *if1_seq = node->seq_out[HSR_PT_SLAVE_B]; in hsr_get_node_data()
572 *if2_seq = node->seq_out[HSR_PT_SLAVE_A]; in hsr_get_node_data()
574 if (node->addr_B_port != HSR_PT_NONE) { in hsr_get_node_data()
575 port = hsr_port_get_hsr(hsr, node->addr_B_port); in hsr_get_node_data()