aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-03-31 07:52:14 -0400
committerDavid S. Miller <davem@davemloft.net>2011-03-31 07:52:14 -0400
commit83229aa5e2c242163599266a686483e3b91ec07e (patch)
treee4dad24604077a6ca1cd1542e3d3de8b6365cedc
parent0a5c047507aaaf00519921336d19c0f8f5f9f363 (diff)
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: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/flow.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/net/flow.h b/include/net/flow.h
index 7fe5a0f9483a..37e77d66f78c 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -70,6 +70,27 @@ struct flowi4 {
70#define fl4_gre_key uli.gre_key 70#define fl4_gre_key uli.gre_key
71}; 71};
72 72
73static inline void flowi4_init_output(struct flowi4 *fl4, int oif,
74 __u32 mark, __u8 tos, __u8 scope,
75 __u8 proto, __u8 flags,
76 __be32 daddr, __be32 saddr,
77 __be16 dport, __be32 sport)
78{
79 fl4->flowi4_oif = oif;
80 fl4->flowi4_iif = 0;
81 fl4->flowi4_mark = mark;
82 fl4->flowi4_tos = tos;
83 fl4->flowi4_scope = scope;
84 fl4->flowi4_proto = proto;
85 fl4->flowi4_flags = flags;
86 fl4->flowi4_secid = 0;
87 fl4->daddr = daddr;
88 fl4->saddr = saddr;
89 fl4->fl4_sport = sport;
90 fl4->fl4_dport = dport;
91}
92
93
73struct flowi6 { 94struct flowi6 {
74 struct flowi_common __fl_common; 95 struct flowi_common __fl_common;
75#define flowi6_oif __fl_common.flowic_oif 96#define flowi6_oif __fl_common.flowic_oif