[ovs-dev] [PATCH v3 3/3] ofp-actions: Add limit to learn action.
Ben Pfaff
blp at ovn.org
Thu Mar 16 20:41:55 UTC 2017
On Fri, Mar 10, 2017 at 03:44:40PM -0800, Daniele Di Proietto wrote:
> 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 at vmware.com>
Thanks!
>From looking at the code I had questions about the difference between
'slow' and 'avoid_caching', but the commit message answered them.
Therefore I'm folding in the following explanation, and then I'll apply
this series to master:
--- a/ofproto/ofproto-dpif-xlate.h
+++ b/ofproto/ofproto-dpif-xlate.h
@@ -38,13 +38,28 @@ struct mcast_snooping;
struct xlate_cache;
struct xlate_out {
- enum slow_path_reason slow; /* 0 if fast path may be used. */
-
- bool avoid_caching; /* If true, the result of this translation shouldn't
- be cached. */
+ /* Caching exceptions:
+ *
+ * - If 'slow' is nonzero, the translation needs to be slow-pathed for
+ * one reason or another. (The particular value is only important for
+ * explaining to an administrator why the flow is slow-pathed.) This
+ * makes OVS install a datapath flow with a send-to-userspace action.
+ * Only on revalidation will the flow be replaced, if appropriate, by
+ * one that does something else with the traffic.
+ *
+ * - If 'avoid_caching' is true, then OVS won't install a datapath flow
+ * at all. If the reason to avoid caching goes away, the next upcall
+ * will immediately install a correct datapath flow.
+ *
+ * - Otherwise a datapath flow can be installed in the usual way.
+ *
+ * If 'avoid_caching' is true then 'slow' doesn't matter.
+ */
+ enum slow_path_reason slow;
+ bool avoid_caching;
- struct recirc_refs recircs; /* Recirc action IDs on which references are
- * held. */
+ /* Recirc action IDs on which references are held. */
+ struct recirc_refs recircs;
};
struct xlate_in {
More information about the dev
mailing list