net: introduce skb_flow_dissect()

We use at least two flow dissectors in network stack, with known
limitations and code duplication.

Introduce skb_flow_dissect() to factorize this, highly inspired from
existing dissector from __skb_get_rxhash()

Note : We extensively use skb_header_pointer(), this permits us to not
touch skb at all.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Eric Dumazet
2011-11-28 05:22:18 +00:00
committed by David S. Miller
parent de0396f400
commit 0744dd00c1
3 changed files with 150 additions and 1 deletions

15
include/net/flow_keys.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef _NET_FLOW_KEYS_H
#define _NET_FLOW_KEYS_H
struct flow_keys {
__be32 src;
__be32 dst;
union {
__be32 ports;
__be16 port16[2];
};
u8 ip_proto;
};
extern bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow);
#endif