Blame view
include/net/llc.h
4.38 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#ifndef LLC_H #define LLC_H /* * Copyright (c) 1997 by Procom Technology, Inc. * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br> * * This program can be redistributed or modified under the terms of the * GNU General Public License as published by the Free Software Foundation. * This program is distributed without any warranty or implied warranty * of merchantability or fitness for a particular purpose. * * See the GNU General Public License for more details. */ #include <linux/if.h> #include <linux/if_ether.h> #include <linux/list.h> #include <linux/spinlock.h> |
b76f5a842 llc: convert the ... |
19 |
#include <linux/rculist_nulls.h> |
52d58aef5 llc: replace the ... |
20 21 |
#include <linux/hash.h> #include <linux/jhash.h> |
1da177e4c Linux-2.6.12-rc2 |
22 |
|
60063497a atomic: use <linu... |
23 |
#include <linux/atomic.h> |
6e2144b76 [LLC]: Use refcou... |
24 |
|
1da177e4c Linux-2.6.12-rc2 |
25 26 27 28 29 30 31 32 33 34 35 |
struct net_device; struct packet_type; struct sk_buff; struct llc_addr { unsigned char lsap; unsigned char mac[IFHWADDRLEN]; }; #define LLC_SAP_STATE_INACTIVE 1 #define LLC_SAP_STATE_ACTIVE 2 |
6d2e3ea28 llc: use a device... |
36 37 |
#define LLC_SK_DEV_HASH_BITS 6 #define LLC_SK_DEV_HASH_ENTRIES (1<<LLC_SK_DEV_HASH_BITS) |
52d58aef5 llc: replace the ... |
38 39 |
#define LLC_SK_LADDR_HASH_BITS 6 #define LLC_SK_LADDR_HASH_ENTRIES (1<<LLC_SK_LADDR_HASH_BITS) |
1da177e4c Linux-2.6.12-rc2 |
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
/** * struct llc_sap - Defines the SAP component * * @station - station this sap belongs to * @state - sap state * @p_bit - only lowest-order bit used * @f_bit - only lowest-order bit used * @laddr - SAP value in this 'lsap' * @node - entry in station sap_list * @sk_list - LLC sockets this one manages */ struct llc_sap { unsigned char state; unsigned char p_bit; unsigned char f_bit; |
58951dde0 net, llc: convert... |
55 |
refcount_t refcnt; |
1da177e4c Linux-2.6.12-rc2 |
56 57 |
int (*rcv_func)(struct sk_buff *skb, struct net_device *dev, |
f2ccd8fa0 [NET]: Kill skb->... |
58 59 |
struct packet_type *pt, struct net_device *orig_dev); |
1da177e4c Linux-2.6.12-rc2 |
60 61 |
struct llc_addr laddr; struct list_head node; |
b76f5a842 llc: convert the ... |
62 |
spinlock_t sk_lock; |
52d58aef5 llc: replace the ... |
63 64 |
int sk_count; struct hlist_nulls_head sk_laddr_hash[LLC_SK_LADDR_HASH_ENTRIES]; |
6d2e3ea28 llc: use a device... |
65 |
struct hlist_head sk_dev_hash[LLC_SK_DEV_HASH_ENTRIES]; |
9708d2b5b llc: avoid blocki... |
66 |
struct rcu_head rcu; |
1da177e4c Linux-2.6.12-rc2 |
67 |
}; |
6d2e3ea28 llc: use a device... |
68 69 70 71 72 |
static inline struct hlist_head *llc_sk_dev_hash(struct llc_sap *sap, int ifindex) { return &sap->sk_dev_hash[ifindex % LLC_SK_DEV_HASH_ENTRIES]; } |
52d58aef5 llc: replace the ... |
73 74 75 76 77 78 79 80 81 82 83 84 85 |
static inline u32 llc_sk_laddr_hashfn(struct llc_sap *sap, const struct llc_addr *laddr) { return hash_32(jhash(laddr->mac, sizeof(laddr->mac), 0), LLC_SK_LADDR_HASH_BITS); } static inline struct hlist_nulls_head *llc_sk_laddr_hash(struct llc_sap *sap, const struct llc_addr *laddr) { return &sap->sk_laddr_hash[llc_sk_laddr_hashfn(sap, laddr)]; } |
6d2e3ea28 llc: use a device... |
86 |
|
1da177e4c Linux-2.6.12-rc2 |
87 88 89 90 91 |
#define LLC_DEST_INVALID 0 /* Invalid LLC PDU type */ #define LLC_DEST_SAP 1 /* Type 1 goes here */ #define LLC_DEST_CONN 2 /* Type 2 goes here */ extern struct list_head llc_sap_list; |
1da177e4c Linux-2.6.12-rc2 |
92 |
|
bf3c710f7 llc*.h: Remove ex... |
93 94 |
int llc_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev); |
1da177e4c Linux-2.6.12-rc2 |
95 |
|
bf3c710f7 llc*.h: Remove ex... |
96 97 |
int llc_mac_hdr_init(struct sk_buff *skb, const unsigned char *sa, const unsigned char *da); |
1da177e4c Linux-2.6.12-rc2 |
98 |
|
bf3c710f7 llc*.h: Remove ex... |
99 100 101 |
void llc_add_pack(int type, void (*handler)(struct llc_sap *sap, struct sk_buff *skb)); void llc_remove_pack(int type); |
1da177e4c Linux-2.6.12-rc2 |
102 |
|
bf3c710f7 llc*.h: Remove ex... |
103 |
void llc_set_station_handler(void (*handler)(struct sk_buff *skb)); |
1da177e4c Linux-2.6.12-rc2 |
104 |
|
bf3c710f7 llc*.h: Remove ex... |
105 106 107 108 109 |
struct llc_sap *llc_sap_open(unsigned char lsap, int (*rcv)(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)); |
6e2144b76 [LLC]: Use refcou... |
110 111 |
static inline void llc_sap_hold(struct llc_sap *sap) { |
58951dde0 net, llc: convert... |
112 |
refcount_inc(&sap->refcnt); |
6e2144b76 [LLC]: Use refcou... |
113 |
} |
0dcb82254 llc: use refcount... |
114 115 116 117 |
static inline bool llc_sap_hold_safe(struct llc_sap *sap) { return refcount_inc_not_zero(&sap->refcnt); } |
bf3c710f7 llc*.h: Remove ex... |
118 |
void llc_sap_close(struct llc_sap *sap); |
2928c19e1 [LLC]: Fix sparse... |
119 |
|
6e2144b76 [LLC]: Use refcou... |
120 121 |
static inline void llc_sap_put(struct llc_sap *sap) { |
58951dde0 net, llc: convert... |
122 |
if (refcount_dec_and_test(&sap->refcnt)) |
6e2144b76 [LLC]: Use refcou... |
123 124 |
llc_sap_close(sap); } |
1da177e4c Linux-2.6.12-rc2 |
125 |
|
bf3c710f7 llc*.h: Remove ex... |
126 |
struct llc_sap *llc_sap_find(unsigned char sap_value); |
1da177e4c Linux-2.6.12-rc2 |
127 |
|
bf3c710f7 llc*.h: Remove ex... |
128 129 |
int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb, unsigned char *dmac, unsigned char dsap); |
1da177e4c Linux-2.6.12-rc2 |
130 |
|
bf3c710f7 llc*.h: Remove ex... |
131 132 |
void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb); void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb); |
2928c19e1 [LLC]: Fix sparse... |
133 |
|
bf3c710f7 llc*.h: Remove ex... |
134 135 |
void llc_station_init(void); void llc_station_exit(void); |
1da177e4c Linux-2.6.12-rc2 |
136 137 |
#ifdef CONFIG_PROC_FS |
bf3c710f7 llc*.h: Remove ex... |
138 139 |
int llc_proc_init(void); void llc_proc_exit(void); |
1da177e4c Linux-2.6.12-rc2 |
140 141 142 143 |
#else #define llc_proc_init() (0) #define llc_proc_exit() do { } while(0) #endif /* CONFIG_PROC_FS */ |
590232a71 [LLC]: Add sysctl... |
144 |
#ifdef CONFIG_SYSCTL |
bf3c710f7 llc*.h: Remove ex... |
145 146 |
int llc_sysctl_init(void); void llc_sysctl_exit(void); |
2928c19e1 [LLC]: Fix sparse... |
147 148 149 150 151 |
extern int sysctl_llc2_ack_timeout; extern int sysctl_llc2_busy_timeout; extern int sysctl_llc2_p_timeout; extern int sysctl_llc2_rej_timeout; |
590232a71 [LLC]: Add sysctl... |
152 153 154 155 |
#else #define llc_sysctl_init() (0) #define llc_sysctl_exit() do { } while(0) #endif /* CONFIG_SYSCTL */ |
1da177e4c Linux-2.6.12-rc2 |
156 |
#endif /* LLC_H */ |