Commit 83229aa5 authored by David S. Miller's avatar David S. Miller

net: Add helper flowi4_init_output().

On-stack initialization via assignment of flow structures are
expensive because GCC emits a memset() to clear the entire
structure out no matter what.

Add a helper for ipv4 output flow key setup which we can use to avoid
the memset.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0a5c0475
...@@ -70,6 +70,27 @@ struct flowi4 { ...@@ -70,6 +70,27 @@ struct flowi4 {
#define fl4_gre_key uli.gre_key #define fl4_gre_key uli.gre_key
}; };
static inline void flowi4_init_output(struct flowi4 *fl4, int oif,
__u32 mark, __u8 tos, __u8 scope,
__u8 proto, __u8 flags,
__be32 daddr, __be32 saddr,
__be16 dport, __be32 sport)
{
fl4->flowi4_oif = oif;
fl4->flowi4_iif = 0;
fl4->flowi4_mark = mark;
fl4->flowi4_tos = tos;
fl4->flowi4_scope = scope;
fl4->flowi4_proto = proto;
fl4->flowi4_flags = flags;
fl4->flowi4_secid = 0;
fl4->daddr = daddr;
fl4->saddr = saddr;
fl4->fl4_sport = sport;
fl4->fl4_dport = dport;
}
struct flowi6 { struct flowi6 {
struct flowi_common __fl_common; struct flowi_common __fl_common;
#define flowi6_oif __fl_common.flowic_oif #define flowi6_oif __fl_common.flowic_oif
......
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