aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/fib_rules.c
diff options
context:
space:
mode:
authorBrian Vazquez <brianvv@google.com>2020-07-26 15:48:16 -0700
committerDavid S. Miller <davem@davemloft.net>2020-07-28 17:42:31 -0700
commitb9aaec8f0be518096d1377082e0abe6a85e86ff3 (patch)
tree44fa946217cb3dba912f903005e2cbae6ae8b06c /net/core/fib_rules.c
parentnet_sched: initialize timer earlier in red_init() (diff)
downloadlinux-dev-b9aaec8f0be518096d1377082e0abe6a85e86ff3.tar.xz
linux-dev-b9aaec8f0be518096d1377082e0abe6a85e86ff3.zip
fib: use indirect call wrappers in the most common fib_rules_ops
This avoids another inderect call per RX packet which save us around 20-40 ns. Changelog: v1 -> v2: - Move declaraions to fib_rules.h to remove warnings Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Brian Vazquez <brianvv@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/fib_rules.c')
-rw-r--r--net/core/fib_rules.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index bd7eba9066f8..e7a8f87b0bb2 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -14,6 +14,7 @@
#include <net/sock.h>
#include <net/fib_rules.h>
#include <net/ip_tunnels.h>
+#include <linux/indirect_call_wrapper.h>
static const struct fib_kuid_range fib_kuid_range_unset = {
KUIDT_INIT(0),
@@ -267,7 +268,10 @@ static int fib_rule_match(struct fib_rule *rule, struct fib_rules_ops *ops,
uid_gt(fl->flowi_uid, rule->uid_range.end))
goto out;
- ret = ops->match(rule, fl, flags);
+ ret = INDIRECT_CALL_INET(ops->match,
+ fib6_rule_match,
+ fib4_rule_match,
+ rule, fl, flags);
out:
return (rule->flags & FIB_RULE_INVERT) ? !ret : ret;
}
@@ -298,9 +302,15 @@ jumped:
} else if (rule->action == FR_ACT_NOP)
continue;
else
- err = ops->action(rule, fl, flags, arg);
-
- if (!err && ops->suppress && ops->suppress(rule, arg))
+ err = INDIRECT_CALL_INET(ops->action,
+ fib6_rule_action,
+ fib4_rule_action,
+ rule, fl, flags, arg);
+
+ if (!err && ops->suppress && INDIRECT_CALL_INET(ops->suppress,
+ fib6_rule_suppress,
+ fib4_rule_suppress,
+ rule, arg))
continue;
if (err != -EAGAIN) {