diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-01 15:09:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-01 15:09:33 -0400 |
commit | 54866f032307063776b4eff7eadb131d47f9f9b4 (patch) | |
tree | 5fb7b5f886b43fbe115e81c14570c40c44956b53 /include | |
parent | b4d367fb20ed19be4a53fa88b407248aeb8bd461 (diff) | |
parent | 49259d34c52df6be482fefca946debe28ba9a2f6 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
[IRDA] IRNET: Fix build when TCGETS2 is defined.
[NET]: docbook fixes for netif_ functions
[NET]: Hide the net_ns kmem cache
[NET]: Mark the setup_net as __net_init
[NET]: Hide the dead code in the net_namespace.c
[NET]: Relax the reference counting of init_net_ns
[NETNS]: Make the init/exit hooks checks outside the loop
[NET]: Forget the zero_it argument of sk_alloc()
[NET]: Remove bogus zero_it argument from sk_alloc
[NET]: Make the sk_clone() lighter
[NET]: Move some core sock setup into sk_prot_alloc
[NET]: Auto-zero the allocated sock object
[NET]: Cleanup the allocation/freeing of the sock object
[NET]: Move the get_net() from sock_copy()
[NET]: Move the sock_copy() from the header
[TCP]: Another TAGBITS -> SACKED_ACKED|LOST conversion
[TCP]: Process DSACKs that reside within a SACK block
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/netdevice.h | 10 | ||||
-rw-r--r-- | include/net/net_namespace.h | 33 | ||||
-rw-r--r-- | include/net/sock.h | 16 |
3 files changed, 36 insertions, 23 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 9b0c8f12373e..1e6af4f174b6 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -739,6 +739,16 @@ static inline void *netdev_priv(const struct net_device *dev) | |||
739 | */ | 739 | */ |
740 | #define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev)) | 740 | #define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev)) |
741 | 741 | ||
742 | /** | ||
743 | * netif_napi_add - initialize a napi context | ||
744 | * @dev: network device | ||
745 | * @napi: napi context | ||
746 | * @poll: polling function | ||
747 | * @weight: default weight | ||
748 | * | ||
749 | * netif_napi_add() must be used to initialize a napi context prior to calling | ||
750 | * *any* of the other napi related functions. | ||
751 | */ | ||
742 | static inline void netif_napi_add(struct net_device *dev, | 752 | static inline void netif_napi_add(struct net_device *dev, |
743 | struct napi_struct *napi, | 753 | struct napi_struct *napi, |
744 | int (*poll)(struct napi_struct *, int), | 754 | int (*poll)(struct napi_struct *, int), |
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 5279466606d2..1fd449a6530b 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -51,13 +51,12 @@ static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns) | |||
51 | } | 51 | } |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | #ifdef CONFIG_NET_NS | ||
54 | extern void __put_net(struct net *net); | 55 | extern void __put_net(struct net *net); |
55 | 56 | ||
56 | static inline struct net *get_net(struct net *net) | 57 | static inline struct net *get_net(struct net *net) |
57 | { | 58 | { |
58 | #ifdef CONFIG_NET | ||
59 | atomic_inc(&net->count); | 59 | atomic_inc(&net->count); |
60 | #endif | ||
61 | return net; | 60 | return net; |
62 | } | 61 | } |
63 | 62 | ||
@@ -75,26 +74,44 @@ static inline struct net *maybe_get_net(struct net *net) | |||
75 | 74 | ||
76 | static inline void put_net(struct net *net) | 75 | static inline void put_net(struct net *net) |
77 | { | 76 | { |
78 | #ifdef CONFIG_NET | ||
79 | if (atomic_dec_and_test(&net->count)) | 77 | if (atomic_dec_and_test(&net->count)) |
80 | __put_net(net); | 78 | __put_net(net); |
81 | #endif | ||
82 | } | 79 | } |
83 | 80 | ||
84 | static inline struct net *hold_net(struct net *net) | 81 | static inline struct net *hold_net(struct net *net) |
85 | { | 82 | { |
86 | #ifdef CONFIG_NET | ||
87 | atomic_inc(&net->use_count); | 83 | atomic_inc(&net->use_count); |
88 | #endif | ||
89 | return net; | 84 | return net; |
90 | } | 85 | } |
91 | 86 | ||
92 | static inline void release_net(struct net *net) | 87 | static inline void release_net(struct net *net) |
93 | { | 88 | { |
94 | #ifdef CONFIG_NET | ||
95 | atomic_dec(&net->use_count); | 89 | atomic_dec(&net->use_count); |
96 | #endif | ||
97 | } | 90 | } |
91 | #else | ||
92 | static inline struct net *get_net(struct net *net) | ||
93 | { | ||
94 | return net; | ||
95 | } | ||
96 | |||
97 | static inline void put_net(struct net *net) | ||
98 | { | ||
99 | } | ||
100 | |||
101 | static inline struct net *hold_net(struct net *net) | ||
102 | { | ||
103 | return net; | ||
104 | } | ||
105 | |||
106 | static inline void release_net(struct net *net) | ||
107 | { | ||
108 | } | ||
109 | |||
110 | static inline struct net *maybe_get_net(struct net *net) | ||
111 | { | ||
112 | return net; | ||
113 | } | ||
114 | #endif | ||
98 | 115 | ||
99 | #define for_each_net(VAR) \ | 116 | #define for_each_net(VAR) \ |
100 | list_for_each_entry(VAR, &net_namespace_list, list) | 117 | list_for_each_entry(VAR, &net_namespace_list, list) |
diff --git a/include/net/sock.h b/include/net/sock.h index 43fc3fa50d62..20de3fa7ae40 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -779,7 +779,7 @@ extern void FASTCALL(release_sock(struct sock *sk)); | |||
779 | 779 | ||
780 | extern struct sock *sk_alloc(struct net *net, int family, | 780 | extern struct sock *sk_alloc(struct net *net, int family, |
781 | gfp_t priority, | 781 | gfp_t priority, |
782 | struct proto *prot, int zero_it); | 782 | struct proto *prot); |
783 | extern void sk_free(struct sock *sk); | 783 | extern void sk_free(struct sock *sk); |
784 | extern struct sock *sk_clone(const struct sock *sk, | 784 | extern struct sock *sk_clone(const struct sock *sk, |
785 | const gfp_t priority); | 785 | const gfp_t priority); |
@@ -993,20 +993,6 @@ static inline void sock_graft(struct sock *sk, struct socket *parent) | |||
993 | write_unlock_bh(&sk->sk_callback_lock); | 993 | write_unlock_bh(&sk->sk_callback_lock); |
994 | } | 994 | } |
995 | 995 | ||
996 | static inline void sock_copy(struct sock *nsk, const struct sock *osk) | ||
997 | { | ||
998 | #ifdef CONFIG_SECURITY_NETWORK | ||
999 | void *sptr = nsk->sk_security; | ||
1000 | #endif | ||
1001 | |||
1002 | memcpy(nsk, osk, osk->sk_prot->obj_size); | ||
1003 | get_net(nsk->sk_net); | ||
1004 | #ifdef CONFIG_SECURITY_NETWORK | ||
1005 | nsk->sk_security = sptr; | ||
1006 | security_sk_clone(osk, nsk); | ||
1007 | #endif | ||
1008 | } | ||
1009 | |||
1010 | extern int sock_i_uid(struct sock *sk); | 996 | extern int sock_i_uid(struct sock *sk); |
1011 | extern unsigned long sock_i_ino(struct sock *sk); | 997 | extern unsigned long sock_i_ino(struct sock *sk); |
1012 | 998 | ||