Commit cc7e17ea authored by David S. Miller's avatar David S. Miller

ipv4: Optimize flow initialization in fib_validate_source().

Like in commit 44713b67
("ipv4: Optimize flow initialization in output route lookup."
we can optimize the on-stack flow setup to only initialize
the members which are actually used.

Otherwise we bzero the entire structure, then initialize
explicitly the first half of it.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 67e28ffd
...@@ -193,19 +193,21 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, ...@@ -193,19 +193,21 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
u32 *itag, u32 mark) u32 *itag, u32 mark)
{ {
struct in_device *in_dev; struct in_device *in_dev;
struct flowi fl = { struct flowi fl;
.fl4_dst = src,
.fl4_src = dst,
.fl4_tos = tos,
.mark = mark,
.iif = oif
};
struct fib_result res; struct fib_result res;
int no_addr, rpf, accept_local; int no_addr, rpf, accept_local;
bool dev_match; bool dev_match;
int ret; int ret;
struct net *net; struct net *net;
fl.oif = 0;
fl.iif = oif;
fl.mark = mark;
fl.fl4_dst = src;
fl.fl4_src = dst;
fl.fl4_tos = tos;
fl.fl4_scope = RT_SCOPE_UNIVERSE;
no_addr = rpf = accept_local = 0; no_addr = rpf = accept_local = 0;
in_dev = __in_dev_get_rcu(dev); in_dev = __in_dev_get_rcu(dev);
if (in_dev) { if (in_dev) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment