diff options
author | Daniele Di Proietto <diproiettod@vmware.com> | 2017-03-10 15:44:40 -0800 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2017-03-16 13:42:26 -0700 |
commit | 4c71600d2256641b927e04b75e95751355e799f8 (patch) | |
tree | 0f8393fa951fa4076dfe195864cc67638e64730c /include | |
parent | 2ce5f3114b4c2054b9071e5b139a0a33f50986c3 (diff) | |
download | openvswitch-4c71600d2256641b927e04b75e95751355e799f8.tar.gz |
ofp-actions: Add limit to learn action.
This commit adds a new feature to the learn actions: the possibility to
limit the number of learned flows.
To be compatible with users of the old learn action, a new structure is
introduced as well as a new OpenFlow raw action number.
There's a small corner case when we have to delete the ukey. This
happens when:
* The learned rule has expired (or has been deleted).
* The ukey that learned the rule is still in the datapath.
* No packets hit the datapath flow recently.
In this case we cannot relearn the rule (because there are no new
packets), and the actions might depend on the learn execution, so the
only option is to delete the ukey. I don't think this has big
performance implications since it's done only for ukey with no traffic.
We could also slowpath it, but that will cause an action upcall and the
correct datapath actions will be installed later by a revalidator. If
we delete the ukey, the next upcall will be a miss upcall and that will
immediatedly install the correct datapath flow.
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/openvswitch/ofp-actions.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/openvswitch/ofp-actions.h b/include/openvswitch/ofp-actions.h index d829509f8..fc2f1def6 100644 --- a/include/openvswitch/ofp-actions.h +++ b/include/openvswitch/ofp-actions.h @@ -660,6 +660,10 @@ struct ofpact_resubmit { * If NX_LEARN_F_SEND_FLOW_REM is set, then the learned flows will have their * OFPFF_SEND_FLOW_REM flag set. * + * If NX_LEARN_F_WRITE_RESULT is set, then the actions will write whether the + * learn operation succeded on a bit. If the learn is successful the bit will + * be set, otherwise (e.g. if the limit is hit) the bit will be unset. + * * If NX_LEARN_F_DELETE_LEARNED is set, then removing this action will delete * all the flows from the learn action's 'table_id' that have the learn * action's 'cookie'. Important points: @@ -685,6 +689,7 @@ struct ofpact_resubmit { enum nx_learn_flags { NX_LEARN_F_SEND_FLOW_REM = 1 << 0, NX_LEARN_F_DELETE_LEARNED = 1 << 1, + NX_LEARN_F_WRITE_RESULT = 1 << 2, }; #define NX_LEARN_N_BITS_MASK 0x3ff @@ -748,6 +753,13 @@ struct ofpact_learn { ovs_be64 cookie; /* Cookie for new flow. */ uint16_t fin_idle_timeout; /* Idle timeout after FIN, if nonzero. */ uint16_t fin_hard_timeout; /* Hard timeout after FIN, if nonzero. */ + /* If the number of flows on 'table_id' with 'cookie' exceeds this, + * the action will not add a new flow. */ + uint32_t limit; + /* Used only if 'flags' has NX_LEARN_F_WRITE_RESULT. If the execution + * failed to install a new flow because 'limit' is exceeded, + * result_dst will be set to 0, otherwise to 1. */ + struct mf_subfield result_dst; ); struct ofpact_learn_spec specs[]; |