Skip to contentSkip to conversation

net/ipv4/: possible cleanups

RFC PATCH In review Adrian Bunk 2 participants 3 messages May 30, 2005 – Jun 26, 2005

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 net/ipv4/: possible cleanups

This patch contains the following possible cleanups:
- make needlessly global code static
- #if 0 the following unused global function:
- xfrm4_state.c: xfrm4_state_fini
- remove the following unneeded EXPORT_SYMBOL's:
- ip_output.c: ip_finish_output
- ip_output.c: sysctl_ip_default_ttl
- fib_frontend.c: ip_dev_find
- inetpeer.c: inet_peer_idlock
- ip_options.c: ip_options_compile
- ip_options.c: ip_options_undo
- tcp_ipv4.c: sysctl_max_syn_backlog

Please review which of these changes are correct and which might conflict with pending patches.

---

This patch was already sent on:
- 7 May 2005

 include/net/ip.h         |    2 --
 include/net/route.h      |    4 ----
 include/net/tcp.h        |    2 --
 include/net/tcp_ecn.h    |   13 -------------
 include/net/xfrm.h       |    1 -
 net/ipv4/fib_frontend.c  |    1 -
 net/ipv4/inetpeer.c      |    2 --
 net/ipv4/ip_options.c    |    3 ---
 net/ipv4/ip_output.c     |    7 +------
 net/ipv4/multipath_drr.c |    2 +-
 net/ipv4/route.c         |    4 +++-
 net/ipv4/tcp_input.c     |   15 ++++++++++++++-
 net/ipv4/tcp_ipv4.c      |    1 -
 net/ipv4/xfrm4_state.c   |    2 ++
 14 files changed, 21 insertions(+), 38 deletions(-)
include/net/ip.h renamed from include/net/ip.h.old +0 -2
@@ -140,8 +140,6 @@
 void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg,
 		   unsigned int len); 
 
-extern int ip_finish_output(struct sk_buff *skb);
-
 struct ipv4_config
 {
 	int	log_martians;
net/ipv4/multipath_drr.c renamed from net/ipv4/multipath_drr.c.old +1 -1
@@ -107,7 +107,7 @@
 	return NOTIFY_DONE;
 }
 
-struct notifier_block drr_dev_notifier = {
+static struct notifier_block drr_dev_notifier = {
 	.notifier_call	= drr_dev_event,
 };
 
net/ipv4/ip_output.c renamed from net/ipv4/ip_output.c.old +1 -6
@@ -216,7 +216,7 @@
 	return -EINVAL;
 }
 
-int ip_finish_output(struct sk_buff *skb)
+static int ip_finish_output(struct sk_buff *skb)
 {
 	struct net_device *dev = skb->dst->dev;
 
@@ -1351,12 +1351,7 @@
 #endif
 }
 
-EXPORT_SYMBOL(ip_finish_output);
 EXPORT_SYMBOL(ip_fragment);
 EXPORT_SYMBOL(ip_generic_getfrag);
 EXPORT_SYMBOL(ip_queue_xmit);
 EXPORT_SYMBOL(ip_send_check);
-
-#ifdef CONFIG_SYSCTL
-EXPORT_SYMBOL(sysctl_ip_default_ttl);
-#endif
include/net/route.h renamed from include/net/route.h.old +0 -4
@@ -105,10 +105,6 @@
         unsigned int out_hlist_search;
 };
 
-extern struct rt_cache_stat *rt_cache_stat;
-#define RT_CACHE_STAT_INC(field)					  \
-		(per_cpu_ptr(rt_cache_stat, _smp_processor_id())->field++)
-
 extern struct ip_rt_acct *ip_rt_acct;
 
 struct in_device;
net/ipv4/route.c renamed from net/ipv4/route.c.old +3 -1
@@ -209,7 +209,9 @@
 static int			rt_hash_log;
 static unsigned int		rt_hash_rnd;
 
-struct rt_cache_stat *rt_cache_stat;
+static struct rt_cache_stat *rt_cache_stat;
+#define RT_CACHE_STAT_INC(field)					  \
+		(per_cpu_ptr(rt_cache_stat, _smp_processor_id())->field++)
 
 static int rt_intern_hash(unsigned hash, struct rtable *rth,
 				struct rtable **res);
include/net/tcp.h renamed from include/net/tcp.h.old +0 -2
@@ -825,8 +825,6 @@
 	}
 }
 
-extern void tcp_enter_quickack_mode(struct tcp_sock *tp);
-
 static __inline__ void tcp_delack_init(struct tcp_sock *tp)
 {
 	memset(&tp->ack, 0, sizeof(tp->ack));
include/net/tcp_ecn.h renamed from include/net/tcp_ecn.h.old +0 -13
@@ -78,19 +78,6 @@
 	tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR;
 }
 
-static inline void TCP_ECN_check_ce(struct tcp_sock *tp, struct sk_buff *skb)
-{
-	if (tp->ecn_flags&TCP_ECN_OK) {
-		if (INET_ECN_is_ce(TCP_SKB_CB(skb)->flags))
-			tp->ecn_flags |= TCP_ECN_DEMAND_CWR;
-		/* Funny extension: if ECT is not set on a segment,
-		 * it is surely retransmit. It is not in ECN RFC,
-		 * but Linux follows this rule. */
-		else if (INET_ECN_is_not_ect((TCP_SKB_CB(skb)->flags)))
-			tcp_enter_quickack_mode(tp);
-	}
-}
-
 static inline void TCP_ECN_rcv_synack(struct tcp_sock *tp, struct tcphdr *th)
 {
 	if ((tp->ecn_flags&TCP_ECN_OK) && (!th->ece || th->cwr))
net/ipv4/tcp_input.c renamed from net/ipv4/tcp_input.c.old +14 -1
@@ -183,13 +183,26 @@
 		tp->ack.quick = min(quickacks, TCP_MAX_QUICKACKS);
 }
 
-void tcp_enter_quickack_mode(struct tcp_sock *tp)
+static void tcp_enter_quickack_mode(struct tcp_sock *tp)
 {
 	tcp_incr_quickack(tp);
 	tp->ack.pingpong = 0;
 	tp->ack.ato = TCP_ATO_MIN;
 }
 
+static inline void TCP_ECN_check_ce(struct tcp_sock *tp, struct sk_buff *skb)
+{
+	if (tp->ecn_flags&TCP_ECN_OK) {
+		if (INET_ECN_is_ce(TCP_SKB_CB(skb)->flags))
+			tp->ecn_flags |= TCP_ECN_DEMAND_CWR;
+		/* Funny extension: if ECT is not set on a segment,
+		 * it is surely retransmit. It is not in ECN RFC,
+		 * but Linux follows this rule. */
+		else if (INET_ECN_is_not_ect((TCP_SKB_CB(skb)->flags)))
+			tcp_enter_quickack_mode(tp);
+	}
+}
+
 /* Send ACKs quickly, if "quick" count is not exhausted
  * and the session is not interactive.
  */
include/net/xfrm.h renamed from include/net/xfrm.h.old +0 -1
@@ -799,7 +799,6 @@
 extern void xfrm6_fini(void);
 extern void xfrm_state_init(void);
 extern void xfrm4_state_init(void);
-extern void xfrm4_state_fini(void);
 extern void xfrm6_state_init(void);
 extern void xfrm6_state_fini(void);
 
net/ipv4/xfrm4_state.c renamed from net/ipv4/xfrm4_state.c.old +2 -0
@@ -119,8 +119,10 @@
 	xfrm_state_register_afinfo(&xfrm4_state_afinfo);
 }
 
+#if 0
 void __exit xfrm4_state_fini(void)
 {
 	xfrm_state_unregister_afinfo(&xfrm4_state_afinfo);
 }
+#endif  /*  0  */
 
net/ipv4/fib_frontend.c renamed from net/ipv4/fib_frontend.c.old +0 -1
@@ -607,5 +607,4 @@
 }
 
 EXPORT_SYMBOL(inet_addr_type);
-EXPORT_SYMBOL(ip_dev_find);
 EXPORT_SYMBOL(ip_rt_ioctl);
net/ipv4/inetpeer.c renamed from net/ipv4/inetpeer.c.old +0 -2
@@ -456,5 +456,3 @@
 			peer_total / inet_peer_threshold * HZ;
 	add_timer(&peer_periodic_timer);
 }
-
-EXPORT_SYMBOL(inet_peer_idlock);
net/ipv4/ip_options.c renamed from net/ipv4/ip_options.c.old +0 -3
@@ -620,6 +620,3 @@
 	}
 	return 0;
 }
-
-EXPORT_SYMBOL(ip_options_compile);
-EXPORT_SYMBOL(ip_options_undo);
net/ipv4/tcp_ipv4.c renamed from net/ipv4/tcp_ipv4.c.old +0 -1
@@ -2660,7 +2660,6 @@
 EXPORT_SYMBOL(tcp_proc_unregister);
 #endif
 EXPORT_SYMBOL(sysctl_local_port_range);
-EXPORT_SYMBOL(sysctl_max_syn_backlog);
 EXPORT_SYMBOL(sysctl_tcp_low_latency);
 EXPORT_SYMBOL(sysctl_tcp_tw_reuse);
 
maintainer
#1 lore raw

From: Adrian Bunk <[email protected]>
Subject: [RFC: 2.6 patch] net/ipv4/: possible cleanups
Date: Mon, 30 May 2005 22:56:51 +0200

Quoted 13 lines

This patch contains the following possible cleanups:
- make needlessly global code static
- #if 0 the following unused global function:
- xfrm4_state.c: xfrm4_state_fini
- remove the following unneeded EXPORT_SYMBOL's:
- ip_output.c: ip_finish_output
- ip_output.c: sysctl_ip_default_ttl
- fib_frontend.c: ip_dev_find
- inetpeer.c: inet_peer_idlock
- ip_options.c: ip_options_compile
- ip_options.c: ip_options_undo
- tcp_ipv4.c: sysctl_max_syn_backlog

Quoted 2 lines

Please review which of these changes are correct and which might conflict with pending patches.

Please keep all of the ECN implementation in the tcp_ecn.h header file, even if the routine is only called in one C file.

And therefore, please do not remove the tcp_enter_quickack_mode() extern declaration from tcp.h

Thanks.

#2 lore raw

PATCH 1/1 net/ipv4/: possible cleanups

Quoted 20 lines · David S. Miller

From: Adrian Bunk <[email protected]>
Subject: [RFC: 2.6 patch] net/ipv4/: possible cleanups
Date: Mon, 30 May 2005 22:56:51 +0200

Quoted 13 lines

This patch contains the following possible cleanups:
- make needlessly global code static
- #if 0 the following unused global function:
- xfrm4_state.c: xfrm4_state_fini
- remove the following unneeded EXPORT_SYMBOL's:
- ip_output.c: ip_finish_output
- ip_output.c: sysctl_ip_default_ttl
- fib_frontend.c: ip_dev_find
- inetpeer.c: inet_peer_idlock
- ip_options.c: ip_options_compile
- ip_options.c: ip_options_undo
- tcp_ipv4.c: sysctl_max_syn_backlog

Quoted 2 lines

Please review which of these changes are correct and which might conflict with pending patches.

Quoted 6 lines

Please keep all of the ECN implementation in the tcp_ecn.h header file, even if the routine is only called in one C file.

And therefore, please do not remove the tcp_enter_quickack_mode() extern declaration from tcp.h

Updated patch below.

Quoted 1 line

Thanks.

cu
Adrian

<-- snip -->

This patch contains the following possible cleanups:
- make needlessly global code static
- #if 0 the following unused global function:
- xfrm4_state.c: xfrm4_state_fini
- remove the following unneeded EXPORT_SYMBOL's:
- ip_output.c: ip_finish_output
- ip_output.c: sysctl_ip_default_ttl
- fib_frontend.c: ip_dev_find
- inetpeer.c: inet_peer_idlock
- ip_options.c: ip_options_compile
- ip_options.c: ip_options_undo
- net/core/request_sock.c: sysctl_max_syn_backlog

---

 include/net/ip.h         |    2 --
 include/net/route.h      |    4 ----
 include/net/xfrm.h       |    1 -
 net/core/request_sock.c  |    1 -
 net/ipv4/fib_frontend.c  |    1 -
 net/ipv4/inetpeer.c      |    2 --
 net/ipv4/ip_options.c    |    3 ---
 net/ipv4/ip_output.c     |    7 +------
 net/ipv4/multipath_drr.c |    2 +-
 net/ipv4/route.c         |    4 +++-
 net/ipv4/xfrm4_state.c   |    2 ++
 11 files changed, 7 insertions(+), 22 deletions(-)
include/net/ip.h renamed from include/net/ip.h.old +0 -2
@@ -140,8 +140,6 @@
 void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg,
 		   unsigned int len); 
 
-extern int ip_finish_output(struct sk_buff *skb);
-
 struct ipv4_config
 {
 	int	log_martians;
net/ipv4/multipath_drr.c renamed from net/ipv4/multipath_drr.c.old +1 -1
@@ -107,7 +107,7 @@
 	return NOTIFY_DONE;
 }
 
-struct notifier_block drr_dev_notifier = {
+static struct notifier_block drr_dev_notifier = {
 	.notifier_call	= drr_dev_event,
 };
 
net/ipv4/ip_output.c renamed from net/ipv4/ip_output.c.old +1 -6
@@ -216,7 +216,7 @@
 	return -EINVAL;
 }
 
-int ip_finish_output(struct sk_buff *skb)
+static int ip_finish_output(struct sk_buff *skb)
 {
 	struct net_device *dev = skb->dst->dev;
 
@@ -1351,12 +1351,7 @@
 #endif
 }
 
-EXPORT_SYMBOL(ip_finish_output);
 EXPORT_SYMBOL(ip_fragment);
 EXPORT_SYMBOL(ip_generic_getfrag);
 EXPORT_SYMBOL(ip_queue_xmit);
 EXPORT_SYMBOL(ip_send_check);
-
-#ifdef CONFIG_SYSCTL
-EXPORT_SYMBOL(sysctl_ip_default_ttl);
-#endif
net/ipv4/route.c renamed from net/ipv4/route.c.old +3 -1
@@ -209,7 +209,9 @@
 static int			rt_hash_log;
 static unsigned int		rt_hash_rnd;
 
-struct rt_cache_stat *rt_cache_stat;
+static struct rt_cache_stat *rt_cache_stat;
+#define RT_CACHE_STAT_INC(field)					  \
+		(per_cpu_ptr(rt_cache_stat, _smp_processor_id())->field++)
 
 static int rt_intern_hash(unsigned hash, struct rtable *rth,
 				struct rtable **res);
include/net/xfrm.h renamed from include/net/xfrm.h.old +0 -1
@@ -799,7 +799,6 @@
 extern void xfrm6_fini(void);
 extern void xfrm_state_init(void);
 extern void xfrm4_state_init(void);
-extern void xfrm4_state_fini(void);
 extern void xfrm6_state_init(void);
 extern void xfrm6_state_fini(void);
 
net/ipv4/xfrm4_state.c renamed from net/ipv4/xfrm4_state.c.old +2 -0
@@ -119,8 +119,10 @@
 	xfrm_state_register_afinfo(&xfrm4_state_afinfo);
 }
 
+#if 0
 void __exit xfrm4_state_fini(void)
 {
 	xfrm_state_unregister_afinfo(&xfrm4_state_afinfo);
 }
+#endif  /*  0  */
 
net/ipv4/fib_frontend.c renamed from net/ipv4/fib_frontend.c.old +0 -1
@@ -607,5 +607,4 @@
 }
 
 EXPORT_SYMBOL(inet_addr_type);
-EXPORT_SYMBOL(ip_dev_find);
 EXPORT_SYMBOL(ip_rt_ioctl);
net/ipv4/inetpeer.c renamed from net/ipv4/inetpeer.c.old +0 -2
@@ -456,5 +456,3 @@
 			peer_total / inet_peer_threshold * HZ;
 	add_timer(&peer_periodic_timer);
 }
-
-EXPORT_SYMBOL(inet_peer_idlock);
net/ipv4/ip_options.c renamed from net/ipv4/ip_options.c.old +0 -3
@@ -620,6 +620,3 @@
 	}
 	return 0;
 }
-
-EXPORT_SYMBOL(ip_options_compile);
-EXPORT_SYMBOL(ip_options_undo);
include/net/route.h renamed from include/net/route.h.old +0 -4
@@ -105,10 +105,6 @@
         unsigned int out_hlist_search;
 };
 
-extern struct rt_cache_stat *rt_cache_stat;
-#define RT_CACHE_STAT_INC(field)					  \
-		(per_cpu_ptr(rt_cache_stat, raw_smp_processor_id())->field++)
-
 extern struct ip_rt_acct *ip_rt_acct;
 
 struct in_device;
net/core/request_sock.c renamed from net/core/request_sock.c.old +0 -1
@@ -32,7 +32,6 @@
  * Further increasing requires to change hash table size.
  */
 int sysctl_max_syn_backlog = 256;
-EXPORT_SYMBOL(sysctl_max_syn_backlog);
 
 int reqsk_queue_alloc(struct request_sock_queue *queue,
 		      const int nr_table_entries)