From f1a6c4da14c365d3ee0b5de43a93f7470982637c Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Thu, 1 Nov 2007 00:29:45 -0700 Subject: [NET]: Move the sock_copy() from the header The sock_copy() call is not used outside the sock.c file, so just move it into a sock.c Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- include/net/sock.h | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'include') diff --git a/include/net/sock.h b/include/net/sock.h index 43fc3fa50d6..ecad7b4e2a6 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -993,20 +993,6 @@ static inline void sock_graft(struct sock *sk, struct socket *parent) write_unlock_bh(&sk->sk_callback_lock); } -static inline void sock_copy(struct sock *nsk, const struct sock *osk) -{ -#ifdef CONFIG_SECURITY_NETWORK - void *sptr = nsk->sk_security; -#endif - - memcpy(nsk, osk, osk->sk_prot->obj_size); - get_net(nsk->sk_net); -#ifdef CONFIG_SECURITY_NETWORK - nsk->sk_security = sptr; - security_sk_clone(osk, nsk); -#endif -} - extern int sock_i_uid(struct sock *sk); extern unsigned long sock_i_ino(struct sock *sk); -- cgit v1.2.3 From 6257ff2177ff02d7f260a7a501876aa41cb9a9f6 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Thu, 1 Nov 2007 00:39:31 -0700 Subject: [NET]: Forget the zero_it argument of sk_alloc() Finally, the zero_it argument can be completely removed from the callers and from the function prototype. Besides, fix the checkpatch.pl warnings about using the assignments inside if-s. This patch is rather big, and it is a part of the previous one. I splitted it wishing to make the patches more readable. Hope this particular split helped. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- include/net/sock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/sock.h b/include/net/sock.h index ecad7b4e2a6..20de3fa7ae4 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -779,7 +779,7 @@ extern void FASTCALL(release_sock(struct sock *sk)); extern struct sock *sk_alloc(struct net *net, int family, gfp_t priority, - struct proto *prot, int zero_it); + struct proto *prot); extern void sk_free(struct sock *sk); extern struct sock *sk_clone(const struct sock *sk, const gfp_t priority); -- cgit v1.2.3 From d46557955f2a35e58772518775464cdf354b3245 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Thu, 1 Nov 2007 00:43:49 -0700 Subject: [NET]: Relax the reference counting of init_net_ns When the CONFIG_NET_NS is n there's no need in refcounting the initial net namespace. So relax this code by making a stupid stubs for the "n" case. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- include/net/net_namespace.h | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 5279466606d..1fd449a6530 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) } #endif +#ifdef CONFIG_NET_NS extern void __put_net(struct net *net); static inline struct net *get_net(struct net *net) { -#ifdef CONFIG_NET atomic_inc(&net->count); -#endif return net; } @@ -75,26 +74,44 @@ static inline struct net *maybe_get_net(struct net *net) static inline void put_net(struct net *net) { -#ifdef CONFIG_NET if (atomic_dec_and_test(&net->count)) __put_net(net); -#endif } static inline struct net *hold_net(struct net *net) { -#ifdef CONFIG_NET atomic_inc(&net->use_count); -#endif return net; } static inline void release_net(struct net *net) { -#ifdef CONFIG_NET atomic_dec(&net->use_count); -#endif } +#else +static inline struct net *get_net(struct net *net) +{ + return net; +} + +static inline void put_net(struct net *net) +{ +} + +static inline struct net *hold_net(struct net *net) +{ + return net; +} + +static inline void release_net(struct net *net) +{ +} + +static inline struct net *maybe_get_net(struct net *net) +{ + return net; +} +#endif #define for_each_net(VAR) \ list_for_each_entry(VAR, &net_namespace_list, list) -- cgit v1.2.3 From 3b582cc14c50f71eabf1c3cada05acb8dc9f457c Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 1 Nov 2007 02:21:47 -0700 Subject: [NET]: docbook fixes for netif_ functions Documentation updates for network interfaces. 1. Add doc for netif_napi_add 2. Remove doc for unused returns from netif_rx 3. Add doc for netif_receive_skb [ Incorporated minor mods from Randy Dunlap -DaveM ] Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller --- include/linux/netdevice.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 9b0c8f12373..1e6af4f174b 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) */ #define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev)) +/** + * netif_napi_add - initialize a napi context + * @dev: network device + * @napi: napi context + * @poll: polling function + * @weight: default weight + * + * netif_napi_add() must be used to initialize a napi context prior to calling + * *any* of the other napi related functions. + */ static inline void netif_napi_add(struct net_device *dev, struct napi_struct *napi, int (*poll)(struct napi_struct *, int), -- cgit v1.2.3