Le vendredi 25 novembre 2011 à 14:02 +0100, Eric Dumazet a écrit : > cls_flow is not complete, since it doesnt handle tunnels for example. > > It calls a 'partial flow classifier' to find each needed element, one by > one. > (adding tunnel decap would need to perform this several time for each > packet) > > __skb_get_rxhash() is more tunnel aware, yet some protocols are still > missing, for example IPPROTO_IPV6. > > Instead of adding logic to both dissectors, we could have a central flow > dissector, filling a temporary pivot structure with found elements (src > addr, dst addr, ports, ...), going through tunnels encap if found. > > Then net/sched/cls_flow.c could pick needed elems from this structure to > compute the hash as specified in tc command : > (for example : tc filter ... flow hash keys proto-dst,dst ...) > > (One dissector call per packet for any number of keys in the filter) > > Same for net/sched/sch_sfb.c : Use the pivot structure and compute the > two hashes (using two hashrnd values) > > And __skb_get_rxhash() could use the same flow dissector, and pick (src > addr, dst addr, ports) to compute skb->rxhash, and set skb->l4_rxhash if > "ports" is not null. >
Here is a patch serie doing this factorization / cleanup. [PATCH net-next 1/4] net: introduce skb_flow_dissect() [PATCH net-next 2/4] net: use skb_flow_dissect() in __skb_get_rxhash() [PATCH net-next 3/4] cls_flow: use skb_flow_dissect() [PATCH net-next 4/4] sch_sfb: use skb_flow_dissect() Signed-off-by: Eric Dumazet <eric.duma...@gmail.com> cumulative diffstat : include/net/flow_keys.h | 15 +++ net/core/Makefile | 2 net/core/dev.c | 124 ++---------------------- net/core/flow_dissector.c | 130 ++++++++++++++++++++++++++ net/ipv4/tcp.c | 8 - net/sched/cls_flow.c | 180 +++++++++--------------------------- net/sched/sch_sfb.c | 17 ++- 7 files changed, 225 insertions(+), 251 deletions(-) _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev