aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/llc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/llc.h')
-rw-r--r--include/net/llc.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/net/llc.h b/include/net/llc.h
index 8b8e2be289b1..93e5b443a9a7 100644
--- a/include/net/llc.h
+++ b/include/net/llc.h
@@ -17,6 +17,8 @@
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19 19
20#include <asm/atomic.h>
21
20struct net_device; 22struct net_device;
21struct packet_type; 23struct packet_type;
22struct sk_buff; 24struct sk_buff;
@@ -44,6 +46,7 @@ struct llc_sap {
44 unsigned char state; 46 unsigned char state;
45 unsigned char p_bit; 47 unsigned char p_bit;
46 unsigned char f_bit; 48 unsigned char f_bit;
49 atomic_t refcnt;
47 int (*rcv_func)(struct sk_buff *skb, 50 int (*rcv_func)(struct sk_buff *skb,
48 struct net_device *dev, 51 struct net_device *dev,
49 struct packet_type *pt, 52 struct packet_type *pt,
@@ -81,7 +84,18 @@ extern struct llc_sap *llc_sap_open(unsigned char lsap,
81 struct net_device *dev, 84 struct net_device *dev,
82 struct packet_type *pt, 85 struct packet_type *pt,
83 struct net_device *orig_dev)); 86 struct net_device *orig_dev));
84extern void llc_sap_close(struct llc_sap *sap); 87static inline void llc_sap_hold(struct llc_sap *sap)
88{
89 atomic_inc(&sap->refcnt);
90}
91
92static inline void llc_sap_put(struct llc_sap *sap)
93{
94 extern void llc_sap_close(struct llc_sap *sap);
95
96 if (atomic_dec_and_test(&sap->refcnt))
97 llc_sap_close(sap);
98}
85 99
86extern struct llc_sap *llc_sap_find(unsigned char sap_value); 100extern struct llc_sap *llc_sap_find(unsigned char sap_value);
87 101