Loading net/batman-adv/bat_iv_ogm.c +2 −1 Original line number Diff line number Diff line Loading @@ -336,7 +336,8 @@ batadv_iv_ogm_neigh_new(struct batadv_hard_iface *hard_iface, { struct batadv_neigh_node *neigh_node; neigh_node = batadv_neigh_node_new(orig_node, hard_iface, neigh_addr); neigh_node = batadv_neigh_node_get_or_create(orig_node, hard_iface, neigh_addr); if (!neigh_node) goto out; Loading net/batman-adv/bat_v_elp.c +2 −1 Original line number Diff line number Diff line Loading @@ -443,7 +443,8 @@ static void batadv_v_elp_neigh_update(struct batadv_priv *bat_priv, if (!orig_neigh) return; neigh = batadv_neigh_node_new(orig_neigh, if_incoming, neigh_addr); neigh = batadv_neigh_node_get_or_create(orig_neigh, if_incoming, neigh_addr); if (!neigh) goto orig_free; Loading net/batman-adv/bat_v_ogm.c +2 −2 Original line number Diff line number Diff line Loading @@ -683,7 +683,7 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset, if (!orig_node) return; neigh_node = batadv_neigh_node_new(orig_node, if_incoming, neigh_node = batadv_neigh_node_get_or_create(orig_node, if_incoming, ethhdr->h_source); if (!neigh_node) goto out; Loading net/batman-adv/originator.c +29 −6 Original line number Diff line number Diff line Loading @@ -602,17 +602,17 @@ batadv_hardif_neigh_get(const struct batadv_hard_iface *hard_iface, } /** * batadv_neigh_node_new - create and init a new neigh_node object * batadv_neigh_node_create - create a neigh node object * @orig_node: originator object representing the neighbour * @hard_iface: the interface where the neighbour is connected to * @neigh_addr: the mac address of the neighbour interface * * Allocates a new neigh_node object and initialises all the generic fields. * * Return: neighbor when found. Othwerwise NULL * Return: the neighbour node if found or created or NULL otherwise. */ struct batadv_neigh_node * batadv_neigh_node_new(struct batadv_orig_node *orig_node, static struct batadv_neigh_node * batadv_neigh_node_create(struct batadv_orig_node *orig_node, struct batadv_hard_iface *hard_iface, const u8 *neigh_addr) { Loading Loading @@ -666,6 +666,29 @@ out: return neigh_node; } /** * batadv_neigh_node_get_or_create - retrieve or create a neigh node object * @orig_node: originator object representing the neighbour * @hard_iface: the interface where the neighbour is connected to * @neigh_addr: the mac address of the neighbour interface * * Return: the neighbour node if found or created or NULL otherwise. */ struct batadv_neigh_node * batadv_neigh_node_get_or_create(struct batadv_orig_node *orig_node, struct batadv_hard_iface *hard_iface, const u8 *neigh_addr) { struct batadv_neigh_node *neigh_node = NULL; /* first check without locking to avoid the overhead */ neigh_node = batadv_neigh_node_get(orig_node, hard_iface, neigh_addr); if (neigh_node) return neigh_node; return batadv_neigh_node_create(orig_node, hard_iface, neigh_addr); } /** * batadv_hardif_neigh_seq_print_text - print the single hop neighbour list * @seq: neighbour table seq_file struct Loading net/batman-adv/originator.h +3 −3 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ batadv_hardif_neigh_get(const struct batadv_hard_iface *hard_iface, void batadv_hardif_neigh_put(struct batadv_hardif_neigh_node *hardif_neigh); struct batadv_neigh_node * batadv_neigh_node_new(struct batadv_orig_node *orig_node, batadv_neigh_node_get_or_create(struct batadv_orig_node *orig_node, struct batadv_hard_iface *hard_iface, const u8 *neigh_addr); void batadv_neigh_node_put(struct batadv_neigh_node *neigh_node); Loading Loading
net/batman-adv/bat_iv_ogm.c +2 −1 Original line number Diff line number Diff line Loading @@ -336,7 +336,8 @@ batadv_iv_ogm_neigh_new(struct batadv_hard_iface *hard_iface, { struct batadv_neigh_node *neigh_node; neigh_node = batadv_neigh_node_new(orig_node, hard_iface, neigh_addr); neigh_node = batadv_neigh_node_get_or_create(orig_node, hard_iface, neigh_addr); if (!neigh_node) goto out; Loading
net/batman-adv/bat_v_elp.c +2 −1 Original line number Diff line number Diff line Loading @@ -443,7 +443,8 @@ static void batadv_v_elp_neigh_update(struct batadv_priv *bat_priv, if (!orig_neigh) return; neigh = batadv_neigh_node_new(orig_neigh, if_incoming, neigh_addr); neigh = batadv_neigh_node_get_or_create(orig_neigh, if_incoming, neigh_addr); if (!neigh) goto orig_free; Loading
net/batman-adv/bat_v_ogm.c +2 −2 Original line number Diff line number Diff line Loading @@ -683,7 +683,7 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset, if (!orig_node) return; neigh_node = batadv_neigh_node_new(orig_node, if_incoming, neigh_node = batadv_neigh_node_get_or_create(orig_node, if_incoming, ethhdr->h_source); if (!neigh_node) goto out; Loading
net/batman-adv/originator.c +29 −6 Original line number Diff line number Diff line Loading @@ -602,17 +602,17 @@ batadv_hardif_neigh_get(const struct batadv_hard_iface *hard_iface, } /** * batadv_neigh_node_new - create and init a new neigh_node object * batadv_neigh_node_create - create a neigh node object * @orig_node: originator object representing the neighbour * @hard_iface: the interface where the neighbour is connected to * @neigh_addr: the mac address of the neighbour interface * * Allocates a new neigh_node object and initialises all the generic fields. * * Return: neighbor when found. Othwerwise NULL * Return: the neighbour node if found or created or NULL otherwise. */ struct batadv_neigh_node * batadv_neigh_node_new(struct batadv_orig_node *orig_node, static struct batadv_neigh_node * batadv_neigh_node_create(struct batadv_orig_node *orig_node, struct batadv_hard_iface *hard_iface, const u8 *neigh_addr) { Loading Loading @@ -666,6 +666,29 @@ out: return neigh_node; } /** * batadv_neigh_node_get_or_create - retrieve or create a neigh node object * @orig_node: originator object representing the neighbour * @hard_iface: the interface where the neighbour is connected to * @neigh_addr: the mac address of the neighbour interface * * Return: the neighbour node if found or created or NULL otherwise. */ struct batadv_neigh_node * batadv_neigh_node_get_or_create(struct batadv_orig_node *orig_node, struct batadv_hard_iface *hard_iface, const u8 *neigh_addr) { struct batadv_neigh_node *neigh_node = NULL; /* first check without locking to avoid the overhead */ neigh_node = batadv_neigh_node_get(orig_node, hard_iface, neigh_addr); if (neigh_node) return neigh_node; return batadv_neigh_node_create(orig_node, hard_iface, neigh_addr); } /** * batadv_hardif_neigh_seq_print_text - print the single hop neighbour list * @seq: neighbour table seq_file struct Loading
net/batman-adv/originator.h +3 −3 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ batadv_hardif_neigh_get(const struct batadv_hard_iface *hard_iface, void batadv_hardif_neigh_put(struct batadv_hardif_neigh_node *hardif_neigh); struct batadv_neigh_node * batadv_neigh_node_new(struct batadv_orig_node *orig_node, batadv_neigh_node_get_or_create(struct batadv_orig_node *orig_node, struct batadv_hard_iface *hard_iface, const u8 *neigh_addr); void batadv_neigh_node_put(struct batadv_neigh_node *neigh_node); Loading