aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2008-01-15 02:44:05 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:02:29 -0500
commit022748a9357c4c1a0113ec1ce5612f383b80156f (patch)
tree9c1d64082f93011732c496d356543faa4ca76e01 /net/ipv4
parentf9ef8a23c37677929e95ad4026a2fa0d449c1d3e (diff)
[NETFILTER]: {ip,ip6}_tables: remove some inlines
This patch removes inlines except those which are used by packet matching code and thus are performance-critical. Before: $ size */*/*/ip*tables*.o text data bss dec hex filename 6402 500 16 6918 1b06 net/ipv4/netfilter/ip_tables.o 7130 500 16 7646 1dde net/ipv6/netfilter/ip6_tables.o After: $ size */*/*/ip*tables*.o text data bss dec hex filename 6307 500 16 6823 1aa7 net/ipv4/netfilter/ip_tables.o 7010 500 16 7526 1d66 net/ipv6/netfilter/ip6_tables.o Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/netfilter/ip_tables.c47
1 files changed, 27 insertions, 20 deletions
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index f5b66ec18b0d..982b7f986291 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -75,6 +75,7 @@ do { \
75 Hence the start of any table is given by get_table() below. */ 75 Hence the start of any table is given by get_table() below. */
76 76
77/* Returns whether matches rule or not. */ 77/* Returns whether matches rule or not. */
78/* Performance critical - called for every packet */
78static inline bool 79static inline bool
79ip_packet_match(const struct iphdr *ip, 80ip_packet_match(const struct iphdr *ip,
80 const char *indev, 81 const char *indev,
@@ -153,7 +154,7 @@ ip_packet_match(const struct iphdr *ip,
153 return true; 154 return true;
154} 155}
155 156
156static inline bool 157static bool
157ip_checkentry(const struct ipt_ip *ip) 158ip_checkentry(const struct ipt_ip *ip)
158{ 159{
159 if (ip->flags & ~IPT_F_MASK) { 160 if (ip->flags & ~IPT_F_MASK) {
@@ -183,8 +184,9 @@ ipt_error(struct sk_buff *skb,
183 return NF_DROP; 184 return NF_DROP;
184} 185}
185 186
186static inline 187/* Performance critical - called for every packet */
187bool do_match(struct ipt_entry_match *m, 188static inline bool
189do_match(struct ipt_entry_match *m,
188 const struct sk_buff *skb, 190 const struct sk_buff *skb,
189 const struct net_device *in, 191 const struct net_device *in,
190 const struct net_device *out, 192 const struct net_device *out,
@@ -199,6 +201,7 @@ bool do_match(struct ipt_entry_match *m,
199 return false; 201 return false;
200} 202}
201 203
204/* Performance critical */
202static inline struct ipt_entry * 205static inline struct ipt_entry *
203get_entry(void *base, unsigned int offset) 206get_entry(void *base, unsigned int offset)
204{ 207{
@@ -206,6 +209,7 @@ get_entry(void *base, unsigned int offset)
206} 209}
207 210
208/* All zeroes == unconditional rule. */ 211/* All zeroes == unconditional rule. */
212/* Mildly perf critical (only if packet tracing is on) */
209static inline int 213static inline int
210unconditional(const struct ipt_ip *ip) 214unconditional(const struct ipt_ip *ip)
211{ 215{
@@ -221,7 +225,7 @@ unconditional(const struct ipt_ip *ip)
221 225
222#if defined(CONFIG_NETFILTER_XT_TARGET_TRACE) || \ 226#if defined(CONFIG_NETFILTER_XT_TARGET_TRACE) || \
223 defined(CONFIG_NETFILTER_XT_TARGET_TRACE_MODULE) 227 defined(CONFIG_NETFILTER_XT_TARGET_TRACE_MODULE)
224static const char *hooknames[] = { 228static const char *const hooknames[] = {
225 [NF_INET_PRE_ROUTING] = "PREROUTING", 229 [NF_INET_PRE_ROUTING] = "PREROUTING",
226 [NF_INET_LOCAL_IN] = "INPUT", 230 [NF_INET_LOCAL_IN] = "INPUT",
227 [NF_INET_FORWARD] = "FORWARD", 231 [NF_INET_FORWARD] = "FORWARD",
@@ -235,7 +239,7 @@ enum nf_ip_trace_comments {
235 NF_IP_TRACE_COMMENT_POLICY, 239 NF_IP_TRACE_COMMENT_POLICY,
236}; 240};
237 241
238static const char *comments[] = { 242static const char *const comments[] = {
239 [NF_IP_TRACE_COMMENT_RULE] = "rule", 243 [NF_IP_TRACE_COMMENT_RULE] = "rule",
240 [NF_IP_TRACE_COMMENT_RETURN] = "return", 244 [NF_IP_TRACE_COMMENT_RETURN] = "return",
241 [NF_IP_TRACE_COMMENT_POLICY] = "policy", 245 [NF_IP_TRACE_COMMENT_POLICY] = "policy",
@@ -251,6 +255,7 @@ static struct nf_loginfo trace_loginfo = {
251 }, 255 },
252}; 256};
253 257
258/* Mildly perf critical (only if packet tracing is on) */
254static inline int 259static inline int
255get_chainname_rulenum(struct ipt_entry *s, struct ipt_entry *e, 260get_chainname_rulenum(struct ipt_entry *s, struct ipt_entry *e,
256 char *hookname, char **chainname, 261 char *hookname, char **chainname,
@@ -567,7 +572,7 @@ mark_source_chains(struct xt_table_info *newinfo,
567 return 1; 572 return 1;
568} 573}
569 574
570static inline int 575static int
571cleanup_match(struct ipt_entry_match *m, unsigned int *i) 576cleanup_match(struct ipt_entry_match *m, unsigned int *i)
572{ 577{
573 if (i && (*i)-- == 0) 578 if (i && (*i)-- == 0)
@@ -579,7 +584,7 @@ cleanup_match(struct ipt_entry_match *m, unsigned int *i)
579 return 0; 584 return 0;
580} 585}
581 586
582static inline int 587static int
583check_entry(struct ipt_entry *e, const char *name) 588check_entry(struct ipt_entry *e, const char *name)
584{ 589{
585 struct ipt_entry_target *t; 590 struct ipt_entry_target *t;
@@ -600,7 +605,8 @@ check_entry(struct ipt_entry *e, const char *name)
600 return 0; 605 return 0;
601} 606}
602 607
603static inline int check_match(struct ipt_entry_match *m, const char *name, 608static int
609check_match(struct ipt_entry_match *m, const char *name,
604 const struct ipt_ip *ip, 610 const struct ipt_ip *ip,
605 unsigned int hookmask, unsigned int *i) 611 unsigned int hookmask, unsigned int *i)
606{ 612{
@@ -623,7 +629,7 @@ static inline int check_match(struct ipt_entry_match *m, const char *name,
623 return ret; 629 return ret;
624} 630}
625 631
626static inline int 632static int
627find_check_match(struct ipt_entry_match *m, 633find_check_match(struct ipt_entry_match *m,
628 const char *name, 634 const char *name,
629 const struct ipt_ip *ip, 635 const struct ipt_ip *ip,
@@ -652,7 +658,7 @@ err:
652 return ret; 658 return ret;
653} 659}
654 660
655static inline int check_target(struct ipt_entry *e, const char *name) 661static int check_target(struct ipt_entry *e, const char *name)
656{ 662{
657 struct ipt_entry_target *t; 663 struct ipt_entry_target *t;
658 struct xt_target *target; 664 struct xt_target *target;
@@ -673,7 +679,7 @@ static inline int check_target(struct ipt_entry *e, const char *name)
673 return ret; 679 return ret;
674} 680}
675 681
676static inline int 682static int
677find_check_entry(struct ipt_entry *e, const char *name, unsigned int size, 683find_check_entry(struct ipt_entry *e, const char *name, unsigned int size,
678 unsigned int *i) 684 unsigned int *i)
679{ 685{
@@ -717,7 +723,7 @@ find_check_entry(struct ipt_entry *e, const char *name, unsigned int size,
717 return ret; 723 return ret;
718} 724}
719 725
720static inline int 726static int
721check_entry_size_and_hooks(struct ipt_entry *e, 727check_entry_size_and_hooks(struct ipt_entry *e,
722 struct xt_table_info *newinfo, 728 struct xt_table_info *newinfo,
723 unsigned char *base, 729 unsigned char *base,
@@ -760,7 +766,7 @@ check_entry_size_and_hooks(struct ipt_entry *e,
760 return 0; 766 return 0;
761} 767}
762 768
763static inline int 769static int
764cleanup_entry(struct ipt_entry *e, unsigned int *i) 770cleanup_entry(struct ipt_entry *e, unsigned int *i)
765{ 771{
766 struct ipt_entry_target *t; 772 struct ipt_entry_target *t;
@@ -916,7 +922,7 @@ get_counters(const struct xt_table_info *t,
916 } 922 }
917} 923}
918 924
919static inline struct xt_counters * alloc_counters(struct xt_table *table) 925static struct xt_counters * alloc_counters(struct xt_table *table)
920{ 926{
921 unsigned int countersize; 927 unsigned int countersize;
922 struct xt_counters *counters; 928 struct xt_counters *counters;
@@ -1304,7 +1310,7 @@ do_replace(void __user *user, unsigned int len)
1304 1310
1305/* We're lazy, and add to the first CPU; overflow works its fey magic 1311/* We're lazy, and add to the first CPU; overflow works its fey magic
1306 * and everything is OK. */ 1312 * and everything is OK. */
1307static inline int 1313static int
1308add_counter_to_entry(struct ipt_entry *e, 1314add_counter_to_entry(struct ipt_entry *e,
1309 const struct xt_counters addme[], 1315 const struct xt_counters addme[],
1310 unsigned int *i) 1316 unsigned int *i)
@@ -1465,7 +1471,7 @@ out:
1465 return ret; 1471 return ret;
1466} 1472}
1467 1473
1468static inline int 1474static int
1469compat_find_calc_match(struct ipt_entry_match *m, 1475compat_find_calc_match(struct ipt_entry_match *m,
1470 const char *name, 1476 const char *name,
1471 const struct ipt_ip *ip, 1477 const struct ipt_ip *ip,
@@ -1489,7 +1495,7 @@ compat_find_calc_match(struct ipt_entry_match *m,
1489 return 0; 1495 return 0;
1490} 1496}
1491 1497
1492static inline int 1498static int
1493compat_release_match(struct ipt_entry_match *m, unsigned int *i) 1499compat_release_match(struct ipt_entry_match *m, unsigned int *i)
1494{ 1500{
1495 if (i && (*i)-- == 0) 1501 if (i && (*i)-- == 0)
@@ -1499,7 +1505,7 @@ compat_release_match(struct ipt_entry_match *m, unsigned int *i)
1499 return 0; 1505 return 0;
1500} 1506}
1501 1507
1502static inline int 1508static int
1503compat_release_entry(struct compat_ipt_entry *e, unsigned int *i) 1509compat_release_entry(struct compat_ipt_entry *e, unsigned int *i)
1504{ 1510{
1505 struct ipt_entry_target *t; 1511 struct ipt_entry_target *t;
@@ -1514,7 +1520,7 @@ compat_release_entry(struct compat_ipt_entry *e, unsigned int *i)
1514 return 0; 1520 return 0;
1515} 1521}
1516 1522
1517static inline int 1523static int
1518check_compat_entry_size_and_hooks(struct compat_ipt_entry *e, 1524check_compat_entry_size_and_hooks(struct compat_ipt_entry *e,
1519 struct xt_table_info *newinfo, 1525 struct xt_table_info *newinfo,
1520 unsigned int *size, 1526 unsigned int *size,
@@ -1637,7 +1643,8 @@ compat_copy_entry_from_user(struct compat_ipt_entry *e, void **dstptr,
1637 return ret; 1643 return ret;
1638} 1644}
1639 1645
1640static inline int compat_check_entry(struct ipt_entry *e, const char *name, 1646static int
1647compat_check_entry(struct ipt_entry *e, const char *name,
1641 unsigned int *i) 1648 unsigned int *i)
1642{ 1649{
1643 int j, ret; 1650 int j, ret;