From: Antonio Quartulli <antonio@meshcoding.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
Antonio Quartulli <antonio@open-mesh.com>,
Marek Lindner <mareklindner@neomailbox.ch>,
Antonio Quartulli <antonio@meshcoding.com>
Subject: [PATCH 3/7] batman-adv: add bat_neigh_free API
Date: Tue, 9 Jun 2015 12:50:16 +0200 [thread overview]
Message-ID: <1433847020-1427-4-git-send-email-antonio@meshcoding.com> (raw)
In-Reply-To: <1433847020-1427-1-git-send-email-antonio@meshcoding.com>
From: Antonio Quartulli <antonio@open-mesh.com>
This API has to be used to let any routing protocol free
neighbor specific allocated resources
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
net/batman-adv/originator.c | 6 ++++++
net/batman-adv/types.h | 4 ++++
2 files changed, 10 insertions(+)
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index e3900e4..aa092c3 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -197,13 +197,19 @@ static void batadv_neigh_node_free_rcu(struct rcu_head *rcu)
struct hlist_node *node_tmp;
struct batadv_neigh_node *neigh_node;
struct batadv_neigh_ifinfo *neigh_ifinfo;
+ struct batadv_algo_ops *bao;
neigh_node = container_of(rcu, struct batadv_neigh_node, rcu);
+ bao = neigh_node->orig_node->bat_priv->bat_algo_ops;
hlist_for_each_entry_safe(neigh_ifinfo, node_tmp,
&neigh_node->ifinfo_list, list) {
batadv_neigh_ifinfo_free_ref_now(neigh_ifinfo);
}
+
+ if (bao->bat_neigh_free)
+ bao->bat_neigh_free(neigh_node);
+
batadv_hardif_free_ref_now(neigh_node->if_incoming);
kfree(neigh_node);
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index c1000c0..336f94b 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -1121,6 +1121,8 @@ struct batadv_forw_packet {
* @bat_neigh_is_equiv_or_better: check if neigh1 is equally good or better
* than neigh2 for their respective outgoing interface from the metric
* prospective
+ * @bat_neigh_free: free the resources allocated by the routing algorithm for a
+ * neigh_node object
* @bat_orig_print: print the originator table (optional)
* @bat_orig_free: free the resources allocated by the routing algorithm for an
* orig_node object
@@ -1138,6 +1140,7 @@ struct batadv_algo_ops {
void (*bat_primary_iface_set)(struct batadv_hard_iface *hard_iface);
void (*bat_ogm_schedule)(struct batadv_hard_iface *hard_iface);
void (*bat_ogm_emit)(struct batadv_forw_packet *forw_packet);
+ /* neigh_node handling API */
int (*bat_neigh_cmp)(struct batadv_neigh_node *neigh1,
struct batadv_hard_iface *if_outgoing1,
struct batadv_neigh_node *neigh2,
@@ -1147,6 +1150,7 @@ struct batadv_algo_ops {
struct batadv_hard_iface *if_outgoing1,
struct batadv_neigh_node *neigh2,
struct batadv_hard_iface *if_outgoing2);
+ void (*bat_neigh_free)(struct batadv_neigh_node *neigh);
/* orig_node handling API */
void (*bat_orig_print)(struct batadv_priv *priv, struct seq_file *seq,
struct batadv_hard_iface *hard_iface);
--
2.4.2
next prev parent reply other threads:[~2015-06-09 10:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-09 10:50 pull request: batman-adv 20150609 Antonio Quartulli
2015-06-09 10:50 ` [PATCH 1/7] batman-adv: Use common Jenkins Hash implementation Antonio Quartulli
2015-06-09 10:50 ` [PATCH 2/7] batman-adv: split name from variable for uint mesh attributes Antonio Quartulli
2015-06-09 10:50 ` Antonio Quartulli [this message]
2015-06-09 10:50 ` [PATCH 4/7] batman-adv: Add required includes to all files Antonio Quartulli
2015-06-09 10:50 ` [PATCH 5/7] batman-adv: Clarify calculation precedence for '&' and '?' Antonio Quartulli
2015-06-09 10:50 ` [PATCH 6/7] batman-adv: Remove unused post-VLAN ethhdr in batadv_gw_dhcp_recipient_get Antonio Quartulli
2015-06-09 10:50 ` [PATCH 7/7] batman-adv: change the MAC of each VLAN upon ndo_set_mac_address Antonio Quartulli
2015-06-10 3:24 ` pull request: batman-adv 20150609 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1433847020-1427-4-git-send-email-antonio@meshcoding.com \
--to=antonio@meshcoding.com \
--cc=antonio@open-mesh.com \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=mareklindner@neomailbox.ch \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).