aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-06-19 21:55:56 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-19 21:55:56 -0400
commitd0b952a9837f81cd89e756b1b34293fa6e1cb59d (patch)
treefbe488bc5f407afa0e91cefb262d9e9ee69062ac /include/net
parentd90125bfe958ed0451c6b98f831c86aba08b43d5 (diff)
parent47552c4e555eefe381f3d45140b59a2ea4b16486 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (109 commits) [ETHTOOL]: Fix UFO typo [SCTP]: Fix persistent slowdown in sctp when a gap ack consumes rx buffer. [SCTP]: Send only 1 window update SACK per message. [SCTP]: Don't do CRC32C checksum over loopback. [SCTP] Reset rtt_in_progress for the chunk when processing its sack. [SCTP]: Reject sctp packets with broadcast addresses. [SCTP]: Limit association max_retrans setting in setsockopt. [PFKEYV2]: Fix inconsistent typing in struct sadb_x_kmprivate. [IPV6]: Sum real space for RTAs. [IRDA]: Use put_unaligned() in irlmp_do_discovery(). [BRIDGE]: Add support for NETIF_F_HW_CSUM devices [NET]: Add NETIF_F_GEN_CSUM and NETIF_F_ALL_CSUM [TG3]: Convert to non-LLTX [TG3]: Remove unnecessary tx_lock [TCP]: Add tcp_slow_start_after_idle sysctl. [BNX2]: Update version and reldate [BNX2]: Use CPU native page size [BNX2]: Use compressed firmware [BNX2]: Add firmware decompression [BNX2]: Allow WoL settings on new 5708 chips ... Manual fixup for conflict in drivers/net/tulip/winbond-840.c
Diffstat (limited to 'include/net')
-rw-r--r--include/net/ip.h1
-rw-r--r--include/net/llc_if.h17
-rw-r--r--include/net/netdma.h44
-rw-r--r--include/net/netfilter/nf_conntrack.h5
-rw-r--r--include/net/netfilter/nf_conntrack_compat.h26
-rw-r--r--include/net/raw.h2
-rw-r--r--include/net/sctp/sctp.h2
-rw-r--r--include/net/sctp/structs.h3
-rw-r--r--include/net/sock.h20
-rw-r--r--include/net/tcp.h15
-rw-r--r--include/net/xfrm.h26
11 files changed, 135 insertions, 26 deletions
diff --git a/include/net/ip.h b/include/net/ip.h
index 3d2e5ca62a5a..ead233c9540d 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -147,7 +147,6 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
147struct ipv4_config 147struct ipv4_config
148{ 148{
149 int log_martians; 149 int log_martians;
150 int autoconfig;
151 int no_pmtu_disc; 150 int no_pmtu_disc;
152}; 151};
153 152
diff --git a/include/net/llc_if.h b/include/net/llc_if.h
index 090eaa0d71f9..c608812a8e89 100644
--- a/include/net/llc_if.h
+++ b/include/net/llc_if.h
@@ -16,6 +16,7 @@
16#include <linux/if.h> 16#include <linux/if.h>
17#include <linux/if_arp.h> 17#include <linux/if_arp.h>
18#include <linux/llc.h> 18#include <linux/llc.h>
19#include <linux/etherdevice.h>
19#include <net/llc.h> 20#include <net/llc.h>
20 21
21#define LLC_DATAUNIT_PRIM 1 22#define LLC_DATAUNIT_PRIM 1
@@ -61,8 +62,6 @@
61#define LLC_STATUS_CONFLICT 7 /* disconnect conn */ 62#define LLC_STATUS_CONFLICT 7 /* disconnect conn */
62#define LLC_STATUS_RESET_DONE 8 /* */ 63#define LLC_STATUS_RESET_DONE 8 /* */
63 64
64extern u8 llc_mac_null_var[IFHWADDRLEN];
65
66/** 65/**
67 * llc_mac_null - determines if a address is a null mac address 66 * llc_mac_null - determines if a address is a null mac address
68 * @mac: Mac address to test if null. 67 * @mac: Mac address to test if null.
@@ -70,16 +69,20 @@ extern u8 llc_mac_null_var[IFHWADDRLEN];
70 * Determines if a given address is a null mac address. Returns 0 if the 69 * Determines if a given address is a null mac address. Returns 0 if the
71 * address is not a null mac, 1 if the address is a null mac. 70 * address is not a null mac, 1 if the address is a null mac.
72 */ 71 */
73static __inline__ int llc_mac_null(u8 *mac) 72static inline int llc_mac_null(const u8 *mac)
74{ 73{
75 return !memcmp(mac, llc_mac_null_var, IFHWADDRLEN); 74 return is_zero_ether_addr(mac);
76} 75}
77 76
78static __inline__ int llc_addrany(struct llc_addr *addr) 77static inline int llc_addrany(const struct llc_addr *addr)
79{ 78{
80 return llc_mac_null(addr->mac) && !addr->lsap; 79 return llc_mac_null(addr->mac) && !addr->lsap;
81} 80}
82 81
82static inline int llc_mac_multicast(const u8 *mac)
83{
84 return is_multicast_ether_addr(mac);
85}
83/** 86/**
84 * llc_mac_match - determines if two mac addresses are the same 87 * llc_mac_match - determines if two mac addresses are the same
85 * @mac1: First mac address to compare. 88 * @mac1: First mac address to compare.
@@ -89,9 +92,9 @@ static __inline__ int llc_addrany(struct llc_addr *addr)
89 * is not a complete match up to len, 1 if a complete match up to len is 92 * is not a complete match up to len, 1 if a complete match up to len is
90 * found. 93 * found.
91 */ 94 */
92static __inline__ int llc_mac_match(u8 *mac1, u8 *mac2) 95static inline int llc_mac_match(const u8 *mac1, const u8 *mac2)
93{ 96{
94 return !memcmp(mac1, mac2, IFHWADDRLEN); 97 return !compare_ether_addr(mac1, mac2);
95} 98}
96 99
97extern int llc_establish_connection(struct sock *sk, u8 *lmac, 100extern int llc_establish_connection(struct sock *sk, u8 *lmac,
diff --git a/include/net/netdma.h b/include/net/netdma.h
new file mode 100644
index 000000000000..19760eb131aa
--- /dev/null
+++ b/include/net/netdma.h
@@ -0,0 +1,44 @@
1/*
2 * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59
16 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called COPYING.
20 */
21#ifndef NETDMA_H
22#define NETDMA_H
23#include <linux/config.h>
24#ifdef CONFIG_NET_DMA
25#include <linux/dmaengine.h>
26#include <linux/skbuff.h>
27
28static inline struct dma_chan *get_softnet_dma(void)
29{
30 struct dma_chan *chan;
31 rcu_read_lock();
32 chan = rcu_dereference(__get_cpu_var(softnet_data.net_dma));
33 if (chan)
34 dma_chan_get(chan);
35 rcu_read_unlock();
36 return chan;
37}
38
39int dma_skb_copy_datagram_iovec(struct dma_chan* chan,
40 const struct sk_buff *skb, int offset, struct iovec *to,
41 size_t len, struct dma_pinned_list *pinned_list);
42
43#endif /* CONFIG_NET_DMA */
44#endif /* NETDMA_H */
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 916013ca4a5c..411117815807 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -114,6 +114,10 @@ struct nf_conn
114 u_int32_t mark; 114 u_int32_t mark;
115#endif 115#endif
116 116
117#ifdef CONFIG_NF_CONNTRACK_SECMARK
118 u_int32_t secmark;
119#endif
120
117 /* Storage reserved for other modules: */ 121 /* Storage reserved for other modules: */
118 union nf_conntrack_proto proto; 122 union nf_conntrack_proto proto;
119 123
@@ -285,6 +289,7 @@ static inline int nf_ct_is_dying(struct nf_conn *ct)
285} 289}
286 290
287extern unsigned int nf_conntrack_htable_size; 291extern unsigned int nf_conntrack_htable_size;
292extern int nf_conntrack_checksum;
288 293
289#define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++) 294#define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++)
290 295
diff --git a/include/net/netfilter/nf_conntrack_compat.h b/include/net/netfilter/nf_conntrack_compat.h
index 3cac19fb3648..f1b1482d7200 100644
--- a/include/net/netfilter/nf_conntrack_compat.h
+++ b/include/net/netfilter/nf_conntrack_compat.h
@@ -20,6 +20,19 @@ static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb,
20} 20}
21#endif /* CONFIG_IP_NF_CONNTRACK_MARK */ 21#endif /* CONFIG_IP_NF_CONNTRACK_MARK */
22 22
23#ifdef CONFIG_IP_NF_CONNTRACK_SECMARK
24static inline u_int32_t *nf_ct_get_secmark(const struct sk_buff *skb,
25 u_int32_t *ctinfo)
26{
27 struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo);
28
29 if (ct)
30 return &ct->secmark;
31 else
32 return NULL;
33}
34#endif /* CONFIG_IP_NF_CONNTRACK_SECMARK */
35
23#ifdef CONFIG_IP_NF_CT_ACCT 36#ifdef CONFIG_IP_NF_CT_ACCT
24static inline struct ip_conntrack_counter * 37static inline struct ip_conntrack_counter *
25nf_ct_get_counters(const struct sk_buff *skb) 38nf_ct_get_counters(const struct sk_buff *skb)
@@ -70,6 +83,19 @@ static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb,
70} 83}
71#endif /* CONFIG_NF_CONNTRACK_MARK */ 84#endif /* CONFIG_NF_CONNTRACK_MARK */
72 85
86#ifdef CONFIG_NF_CONNTRACK_SECMARK
87static inline u_int32_t *nf_ct_get_secmark(const struct sk_buff *skb,
88 u_int32_t *ctinfo)
89{
90 struct nf_conn *ct = nf_ct_get(skb, ctinfo);
91
92 if (ct)
93 return &ct->secmark;
94 else
95 return NULL;
96}
97#endif /* CONFIG_NF_CONNTRACK_MARK */
98
73#ifdef CONFIG_NF_CT_ACCT 99#ifdef CONFIG_NF_CT_ACCT
74static inline struct ip_conntrack_counter * 100static inline struct ip_conntrack_counter *
75nf_ct_get_counters(const struct sk_buff *skb) 101nf_ct_get_counters(const struct sk_buff *skb)
diff --git a/include/net/raw.h b/include/net/raw.h
index e67b28a0248c..d83571fe4c69 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -36,7 +36,7 @@ extern rwlock_t raw_v4_lock;
36 36
37 37
38extern struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num, 38extern struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num,
39 unsigned long raddr, unsigned long laddr, 39 __be32 raddr, __be32 laddr,
40 int dif); 40 int dif);
41 41
42extern int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash); 42extern int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash);
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index aa6033ca7cd8..b2b40f951ae6 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -255,7 +255,7 @@ extern int sctp_debug_flag;
255#define SCTP_DEBUG_PRINTK_IPADDR(whatever...) 255#define SCTP_DEBUG_PRINTK_IPADDR(whatever...)
256#define SCTP_ENABLE_DEBUG 256#define SCTP_ENABLE_DEBUG
257#define SCTP_DISABLE_DEBUG 257#define SCTP_DISABLE_DEBUG
258#define SCTP_ASSERT(expr, str, func) 258#define SCTP_ASSERT(expr, str, func) BUG_ON(!(expr))
259 259
260#endif /* SCTP_DEBUG */ 260#endif /* SCTP_DEBUG */
261 261
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 7f4fea173fb1..5f69158c1006 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -555,7 +555,8 @@ struct sctp_af {
555 int (*to_addr_param) (const union sctp_addr *, 555 int (*to_addr_param) (const union sctp_addr *,
556 union sctp_addr_param *); 556 union sctp_addr_param *);
557 int (*addr_valid) (union sctp_addr *, 557 int (*addr_valid) (union sctp_addr *,
558 struct sctp_sock *); 558 struct sctp_sock *,
559 const struct sk_buff *);
559 sctp_scope_t (*scope) (union sctp_addr *); 560 sctp_scope_t (*scope) (union sctp_addr *);
560 void (*inaddr_any) (union sctp_addr *, unsigned short); 561 void (*inaddr_any) (union sctp_addr *, unsigned short);
561 int (*is_any) (const union sctp_addr *); 562 int (*is_any) (const union sctp_addr *);
diff --git a/include/net/sock.h b/include/net/sock.h
index c9fad6fb629b..96565ff0de6a 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -132,6 +132,7 @@ struct sock_common {
132 * @sk_receive_queue: incoming packets 132 * @sk_receive_queue: incoming packets
133 * @sk_wmem_alloc: transmit queue bytes committed 133 * @sk_wmem_alloc: transmit queue bytes committed
134 * @sk_write_queue: Packet sending queue 134 * @sk_write_queue: Packet sending queue
135 * @sk_async_wait_queue: DMA copied packets
135 * @sk_omem_alloc: "o" is "option" or "other" 136 * @sk_omem_alloc: "o" is "option" or "other"
136 * @sk_wmem_queued: persistent queue size 137 * @sk_wmem_queued: persistent queue size
137 * @sk_forward_alloc: space allocated forward 138 * @sk_forward_alloc: space allocated forward
@@ -205,6 +206,7 @@ struct sock {
205 atomic_t sk_omem_alloc; 206 atomic_t sk_omem_alloc;
206 struct sk_buff_head sk_receive_queue; 207 struct sk_buff_head sk_receive_queue;
207 struct sk_buff_head sk_write_queue; 208 struct sk_buff_head sk_write_queue;
209 struct sk_buff_head sk_async_wait_queue;
208 int sk_wmem_queued; 210 int sk_wmem_queued;
209 int sk_forward_alloc; 211 int sk_forward_alloc;
210 gfp_t sk_allocation; 212 gfp_t sk_allocation;
@@ -871,10 +873,7 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb, int needlock)
871 if (filter) { 873 if (filter) {
872 unsigned int pkt_len = sk_run_filter(skb, filter->insns, 874 unsigned int pkt_len = sk_run_filter(skb, filter->insns,
873 filter->len); 875 filter->len);
874 if (!pkt_len) 876 err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM;
875 err = -EPERM;
876 else
877 skb_trim(skb, pkt_len);
878 } 877 }
879 878
880 if (needlock) 879 if (needlock)
@@ -1271,11 +1270,22 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1271 * This routine must be called with interrupts disabled or with the socket 1270 * This routine must be called with interrupts disabled or with the socket
1272 * locked so that the sk_buff queue operation is ok. 1271 * locked so that the sk_buff queue operation is ok.
1273*/ 1272*/
1274static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb) 1273#ifdef CONFIG_NET_DMA
1274static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_early)
1275{
1276 __skb_unlink(skb, &sk->sk_receive_queue);
1277 if (!copied_early)
1278 __kfree_skb(skb);
1279 else
1280 __skb_queue_tail(&sk->sk_async_wait_queue, skb);
1281}
1282#else
1283static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_early)
1275{ 1284{
1276 __skb_unlink(skb, &sk->sk_receive_queue); 1285 __skb_unlink(skb, &sk->sk_receive_queue);
1277 __kfree_skb(skb); 1286 __kfree_skb(skb);
1278} 1287}
1288#endif
1279 1289
1280extern void sock_enable_timestamp(struct sock *sk); 1290extern void sock_enable_timestamp(struct sock *sk);
1281extern int sock_get_timestamp(struct sock *, struct timeval __user *); 1291extern int sock_get_timestamp(struct sock *, struct timeval __user *);
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 3c989db8a7aa..bfc71f954bbe 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -28,6 +28,7 @@
28#include <linux/cache.h> 28#include <linux/cache.h>
29#include <linux/percpu.h> 29#include <linux/percpu.h>
30#include <linux/skbuff.h> 30#include <linux/skbuff.h>
31#include <linux/dmaengine.h>
31 32
32#include <net/inet_connection_sock.h> 33#include <net/inet_connection_sock.h>
33#include <net/inet_timewait_sock.h> 34#include <net/inet_timewait_sock.h>
@@ -218,6 +219,7 @@ extern int sysctl_tcp_adv_win_scale;
218extern int sysctl_tcp_tw_reuse; 219extern int sysctl_tcp_tw_reuse;
219extern int sysctl_tcp_frto; 220extern int sysctl_tcp_frto;
220extern int sysctl_tcp_low_latency; 221extern int sysctl_tcp_low_latency;
222extern int sysctl_tcp_dma_copybreak;
221extern int sysctl_tcp_nometrics_save; 223extern int sysctl_tcp_nometrics_save;
222extern int sysctl_tcp_moderate_rcvbuf; 224extern int sysctl_tcp_moderate_rcvbuf;
223extern int sysctl_tcp_tso_win_divisor; 225extern int sysctl_tcp_tso_win_divisor;
@@ -225,6 +227,7 @@ extern int sysctl_tcp_abc;
225extern int sysctl_tcp_mtu_probing; 227extern int sysctl_tcp_mtu_probing;
226extern int sysctl_tcp_base_mss; 228extern int sysctl_tcp_base_mss;
227extern int sysctl_tcp_workaround_signed_windows; 229extern int sysctl_tcp_workaround_signed_windows;
230extern int sysctl_tcp_slow_start_after_idle;
228 231
229extern atomic_t tcp_memory_allocated; 232extern atomic_t tcp_memory_allocated;
230extern atomic_t tcp_sockets_allocated; 233extern atomic_t tcp_sockets_allocated;
@@ -293,6 +296,8 @@ extern int tcp_rcv_established(struct sock *sk,
293 296
294extern void tcp_rcv_space_adjust(struct sock *sk); 297extern void tcp_rcv_space_adjust(struct sock *sk);
295 298
299extern void tcp_cleanup_rbuf(struct sock *sk, int copied);
300
296extern int tcp_twsk_unique(struct sock *sk, 301extern int tcp_twsk_unique(struct sock *sk,
297 struct sock *sktw, void *twp); 302 struct sock *sktw, void *twp);
298 303
@@ -628,7 +633,7 @@ struct tcp_congestion_ops {
628 /* return slow start threshold (required) */ 633 /* return slow start threshold (required) */
629 u32 (*ssthresh)(struct sock *sk); 634 u32 (*ssthresh)(struct sock *sk);
630 /* lower bound for congestion window (optional) */ 635 /* lower bound for congestion window (optional) */
631 u32 (*min_cwnd)(struct sock *sk); 636 u32 (*min_cwnd)(const struct sock *sk);
632 /* do new cwnd calculation (required) */ 637 /* do new cwnd calculation (required) */
633 void (*cong_avoid)(struct sock *sk, u32 ack, 638 void (*cong_avoid)(struct sock *sk, u32 ack,
634 u32 rtt, u32 in_flight, int good_ack); 639 u32 rtt, u32 in_flight, int good_ack);
@@ -663,7 +668,7 @@ extern struct tcp_congestion_ops tcp_init_congestion_ops;
663extern u32 tcp_reno_ssthresh(struct sock *sk); 668extern u32 tcp_reno_ssthresh(struct sock *sk);
664extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack, 669extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack,
665 u32 rtt, u32 in_flight, int flag); 670 u32 rtt, u32 in_flight, int flag);
666extern u32 tcp_reno_min_cwnd(struct sock *sk); 671extern u32 tcp_reno_min_cwnd(const struct sock *sk);
667extern struct tcp_congestion_ops tcp_reno; 672extern struct tcp_congestion_ops tcp_reno;
668 673
669static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state) 674static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state)
@@ -817,6 +822,12 @@ static inline void tcp_prequeue_init(struct tcp_sock *tp)
817 tp->ucopy.len = 0; 822 tp->ucopy.len = 0;
818 tp->ucopy.memory = 0; 823 tp->ucopy.memory = 0;
819 skb_queue_head_init(&tp->ucopy.prequeue); 824 skb_queue_head_init(&tp->ucopy.prequeue);
825#ifdef CONFIG_NET_DMA
826 tp->ucopy.dma_chan = NULL;
827 tp->ucopy.wakeup = 0;
828 tp->ucopy.pinned_list = NULL;
829 tp->ucopy.dma_cookie = 0;
830#endif
820} 831}
821 832
822/* Packet is added to VJ-style prequeue for processing in process 833/* Packet is added to VJ-style prequeue for processing in process
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index afa508d92c93..9c5ee9f20b65 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -20,6 +20,8 @@
20#include <net/ip6_fib.h> 20#include <net/ip6_fib.h>
21 21
22#define XFRM_ALIGN8(len) (((len) + 7) & ~7) 22#define XFRM_ALIGN8(len) (((len) + 7) & ~7)
23#define MODULE_ALIAS_XFRM_MODE(family, encap) \
24 MODULE_ALIAS("xfrm-mode-" __stringify(family) "-" __stringify(encap))
23 25
24extern struct sock *xfrm_nl; 26extern struct sock *xfrm_nl;
25extern u32 sysctl_xfrm_aevent_etime; 27extern u32 sysctl_xfrm_aevent_etime;
@@ -164,6 +166,7 @@ struct xfrm_state
164 /* Reference to data common to all the instances of this 166 /* Reference to data common to all the instances of this
165 * transformer. */ 167 * transformer. */
166 struct xfrm_type *type; 168 struct xfrm_type *type;
169 struct xfrm_mode *mode;
167 170
168 /* Security context */ 171 /* Security context */
169 struct xfrm_sec_ctx *security; 172 struct xfrm_sec_ctx *security;
@@ -204,8 +207,8 @@ struct xfrm_type;
204struct xfrm_dst; 207struct xfrm_dst;
205struct xfrm_policy_afinfo { 208struct xfrm_policy_afinfo {
206 unsigned short family; 209 unsigned short family;
207 rwlock_t lock; 210 struct xfrm_type *type_map[IPPROTO_MAX];
208 struct xfrm_type_map *type_map; 211 struct xfrm_mode *mode_map[XFRM_MODE_MAX];
209 struct dst_ops *dst_ops; 212 struct dst_ops *dst_ops;
210 void (*garbage_collect)(void); 213 void (*garbage_collect)(void);
211 int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl); 214 int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl);
@@ -232,7 +235,6 @@ extern int __xfrm_state_delete(struct xfrm_state *x);
232 235
233struct xfrm_state_afinfo { 236struct xfrm_state_afinfo {
234 unsigned short family; 237 unsigned short family;
235 rwlock_t lock;
236 struct list_head *state_bydst; 238 struct list_head *state_bydst;
237 struct list_head *state_byspi; 239 struct list_head *state_byspi;
238 int (*init_flags)(struct xfrm_state *x); 240 int (*init_flags)(struct xfrm_state *x);
@@ -264,16 +266,24 @@ struct xfrm_type
264 u32 (*get_max_size)(struct xfrm_state *, int size); 266 u32 (*get_max_size)(struct xfrm_state *, int size);
265}; 267};
266 268
267struct xfrm_type_map {
268 rwlock_t lock;
269 struct xfrm_type *map[256];
270};
271
272extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); 269extern int xfrm_register_type(struct xfrm_type *type, unsigned short family);
273extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family); 270extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family);
274extern struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family); 271extern struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family);
275extern void xfrm_put_type(struct xfrm_type *type); 272extern void xfrm_put_type(struct xfrm_type *type);
276 273
274struct xfrm_mode {
275 int (*input)(struct xfrm_state *x, struct sk_buff *skb);
276 int (*output)(struct sk_buff *skb);
277
278 struct module *owner;
279 unsigned int encap;
280};
281
282extern int xfrm_register_mode(struct xfrm_mode *mode, int family);
283extern int xfrm_unregister_mode(struct xfrm_mode *mode, int family);
284extern struct xfrm_mode *xfrm_get_mode(unsigned int encap, int family);
285extern void xfrm_put_mode(struct xfrm_mode *mode);
286
277struct xfrm_tmpl 287struct xfrm_tmpl
278{ 288{
279/* id in template is interpreted as: 289/* id in template is interpreted as: