[ovs-dev] Customized match options => miniflow_extract()
Raul Suarez Marin
raul.suarez.marin at gmail.com
Thu Mar 5 22:59:40 UTC 2015
Hello,
I need new match options for my openvswitch. I have already sorted out the
flow_mod message handling and everything. Now, I need to find where the
match is performed, but I cannot find it. Through debugging, I found that
the matching is performed (or part of it) at miniflow_extract() at
lib\flow.c
However, as described in flow.h
/*
* The fields are organized in four segments to facilitate staged lookup,
where
* lower layer fields are first used to determine if the later fields need
to
* be looked at. This enables better wildcarding for datapath flows.
*
* NOTE: Order of the fields is significant, any change in the order must be
* reflected in miniflow_extract()!
*/
struct flow {
blablabla
}
What I did, is to take advantage of a padding field in flow structure, and
use it. This is now what miniflow_extract() assumes to be true (tcp_flags
and new field are 16-bit size).
BUILD_ASSERT_DECL(offsetof(struct flow, tcp_flags) + 2
== offsetof(struct flow, new_field) &&
offsetof(struct flow, tcp_flags) / 4
== offsetof(struct flow, new_field) / 4);
Then, in miniflow_extract(), I use the miniflow_push_be16(mf,
new_field, new_field); sentence (I do not know if this is correct).
Here is my question: where I have to take into account the order of the
fields, as stated in flow.h comment before definition of "struct flow"? Am
I missing/misunderstanding something?
I also do not understand how "miniflow structure" works, I know it is an
optimization of flow structure, but I do not know how it is formed or how
to read one.
ANY clue or documentation is useful.
Thank you for your support.
More information about the dev
mailing list