~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to net/batman-adv/hard-interface.h

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors:
 
2
 * Copyright (C) 2007-2011 B.A.T.M.A.N. contributors:
3
3
 *
4
4
 * Marek Lindner, Simon Wunderlich
5
5
 *
31
31
 
32
32
extern struct notifier_block hard_if_notifier;
33
33
 
34
 
struct batman_if *get_batman_if_by_netdev(struct net_device *net_dev);
35
 
int hardif_enable_interface(struct batman_if *batman_if, char *iface_name);
36
 
void hardif_disable_interface(struct batman_if *batman_if);
 
34
struct hard_iface *hardif_get_by_netdev(struct net_device *net_dev);
 
35
int hardif_enable_interface(struct hard_iface *hard_iface, char *iface_name);
 
36
void hardif_disable_interface(struct hard_iface *hard_iface);
37
37
void hardif_remove_interfaces(void);
38
 
int batman_skb_recv(struct sk_buff *skb,
39
 
                                struct net_device *dev,
40
 
                                struct packet_type *ptype,
41
 
                                struct net_device *orig_dev);
42
38
int hardif_min_mtu(struct net_device *soft_iface);
43
39
void update_min_mtu(struct net_device *soft_iface);
44
 
 
45
 
static inline void hardif_free_ref(struct kref *refcount)
46
 
{
47
 
        struct batman_if *batman_if;
48
 
 
49
 
        batman_if = container_of(refcount, struct batman_if, refcount);
50
 
        kfree(batman_if);
 
40
void hardif_free_rcu(struct rcu_head *rcu);
 
41
 
 
42
static inline void hardif_free_ref(struct hard_iface *hard_iface)
 
43
{
 
44
        if (atomic_dec_and_test(&hard_iface->refcount))
 
45
                call_rcu(&hard_iface->rcu, hardif_free_rcu);
 
46
}
 
47
 
 
48
static inline struct hard_iface *primary_if_get_selected(
 
49
                                                struct bat_priv *bat_priv)
 
50
{
 
51
        struct hard_iface *hard_iface;
 
52
 
 
53
        rcu_read_lock();
 
54
        hard_iface = rcu_dereference(bat_priv->primary_if);
 
55
        if (!hard_iface)
 
56
                goto out;
 
57
 
 
58
        if (!atomic_inc_not_zero(&hard_iface->refcount))
 
59
                hard_iface = NULL;
 
60
 
 
61
out:
 
62
        rcu_read_unlock();
 
63
        return hard_iface;
51
64
}
52
65
 
53
66
#endif /* _NET_BATMAN_ADV_HARD_INTERFACE_H_ */