]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
ipv4: Optimize flow initialization in fib_validate_source().
authorDavid S. Miller <davem@davemloft.net>
Thu, 10 Mar 2011 04:57:50 +0000 (20:57 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 10 Mar 2011 04:57:50 +0000 (20:57 -0800)
Like in commit 44713b67db10c774f14280c129b0d5fd13c70cf2
("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: David S. Miller <davem@davemloft.net>
net/ipv4/fib_frontend.c

index 1d2233cd99e6648947a73f5801a7795e34ce74a9..fe10bcd0f307fc94f3e67d3f05054359a07aa4a9 100644 (file)
@@ -193,19 +193,21 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
                        u32 *itag, u32 mark)
 {
        struct in_device *in_dev;
-       struct flowi fl = {
-               .fl4_dst = src,
-               .fl4_src = dst,
-               .fl4_tos = tos,
-               .mark = mark,
-               .iif = oif
-       };
+       struct flowi fl;
        struct fib_result res;
        int no_addr, rpf, accept_local;
        bool dev_match;
        int ret;
        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;
        in_dev = __in_dev_get_rcu(dev);
        if (in_dev) {