Acked-by: Jarno Rajahalme <jrajaha...@nicira.com>

> On Jul 29, 2015, at 11:42 PM, Ben Pfaff <b...@nicira.com> wrote:
> 
> It isn't otherwise useful and in fact hurts performance so it's disabled
> without --enable-dummy.
> 
> An upcoming commit will make use of this.
> 
> Signed-off-by: Ben Pfaff <b...@nicira.com>
> ---
> lib/dummy.c                  |  1 +
> lib/dummy.h                  |  1 +
> lib/ofp-actions.c            | 61 ++++++++++++++++++++++++++++++++++++++++++++
> lib/ofp-actions.h            |  6 +++++
> ofproto/ofproto-dpif-xlate.c |  6 +++++
> 5 files changed, 75 insertions(+)
> 
> diff --git a/lib/dummy.c b/lib/dummy.c
> index ef36578..5caceee 100644
> --- a/lib/dummy.c
> +++ b/lib/dummy.c
> @@ -46,5 +46,6 @@ dummy_enable(const char *arg)
>     dpif_dummy_register(level);
>     timeval_dummy_register();
>     vlandev_dummy_enable();
> +    ofpact_dummy_enable();
> }
> 
> diff --git a/lib/dummy.h b/lib/dummy.h
> index a94658b..5b8a841 100644
> --- a/lib/dummy.h
> +++ b/lib/dummy.h
> @@ -38,5 +38,6 @@ void dpif_dummy_register(enum dummy_level);
> void netdev_dummy_register(enum dummy_level);
> void timeval_dummy_register(void);
> void vlandev_dummy_enable(void);
> +void ofpact_dummy_enable(void);
> 
> #endif /* dummy.h */
> diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
> index 14a2802..ad88c6e 100644
> --- a/lib/ofp-actions.c
> +++ b/lib/ofp-actions.c
> @@ -19,6 +19,7 @@
> #include "bundle.h"
> #include "byte-order.h"
> #include "compiler.h"
> +#include "dummy.h"
> #include "dynamic-string.h"
> #include "hmap.h"
> #include "learn.h"
> @@ -284,6 +285,16 @@ enum ofp_raw_action_type {
> 
>     /* NX1.0+(34): struct nx_action_conjunction. */
>     NXAST_RAW_CONJUNCTION,
> +
> +/* ## ------------------ ## */
> +/* ## Debugging actions. ## */
> +/* ## ------------------ ## */
> +
> +/* These are intentionally undocumented, subject to change, and ovs-vswitchd 
> */
> +/* accepts them only if started with --enable-dummy. */
> +
> +    /* NX1.0+(255): void. */
> +    NXAST_RAW_DEBUG_RECIRC,
> };
> 
> /* OpenFlow actions are always a multiple of 8 bytes in length. */
> @@ -4384,6 +4395,49 @@ format_SAMPLE(const struct ofpact_sample *a, struct ds 
> *s)
>                   a->obs_domain_id, a->obs_point_id);
> }
> 
> +/* debug_recirc instruction. */
> +
> +static bool enable_debug;
> +
> +void
> +ofpact_dummy_enable(void)
> +{
> +    enable_debug = true;
> +}
> +
> +static enum ofperr
> +decode_NXAST_RAW_DEBUG_RECIRC(struct ofpbuf *out)
> +{
> +    if (!enable_debug) {
> +        return OFPERR_OFPBAC_BAD_VENDOR_TYPE;
> +    }
> +
> +    ofpact_put_DEBUG_RECIRC(out);
> +    return 0;
> +}
> +
> +static void
> +encode_DEBUG_RECIRC(const struct ofpact_null *n OVS_UNUSED,
> +                    enum ofp_version ofp_version OVS_UNUSED,
> +                    struct ofpbuf *out)
> +{
> +    put_NXAST_DEBUG_RECIRC(out);
> +}
> +
> +static char * OVS_WARN_UNUSED_RESULT
> +parse_DEBUG_RECIRC(char *arg OVS_UNUSED, struct ofpbuf *ofpacts,
> +                   enum ofputil_protocol *usable_protocols OVS_UNUSED)
> +{
> +    ofpact_put_DEBUG_RECIRC(ofpacts);
> +    return NULL;
> +}
> +
> +static void
> +format_DEBUG_RECIRC(const struct ofpact_null *a OVS_UNUSED, struct ds *s)
> +{
> +    ds_put_cstr(s, "debug_recirc");
> +}
> +
> /* Meter instruction. */
> 
> static void
> @@ -4790,6 +4844,7 @@ ofpact_is_set_or_move_action(const struct ofpact *a)
>     case OFPACT_STRIP_VLAN:
>     case OFPACT_WRITE_ACTIONS:
>     case OFPACT_WRITE_METADATA:
> +    case OFPACT_DEBUG_RECIRC:
>         return false;
>     default:
>         OVS_NOT_REACHED();
> @@ -4850,6 +4905,7 @@ ofpact_is_allowed_in_actions_set(const struct ofpact *a)
>     case OFPACT_SAMPLE:
>     case OFPACT_STACK_POP:
>     case OFPACT_STACK_PUSH:
> +    case OFPACT_DEBUG_RECIRC:
> 
>     /* The action set may only include actions and thus
>      * may not include any instructions */
> @@ -5063,6 +5119,7 @@ ovs_instruction_type_from_ofpact_type(enum ofpact_type 
> type)
>     case OFPACT_EXIT:
>     case OFPACT_UNROLL_XLATE:
>     case OFPACT_SAMPLE:
> +    case OFPACT_DEBUG_RECIRC:
>     default:
>         return OVSINST_OFPIT11_APPLY_ACTIONS;
>     }
> @@ -5659,6 +5716,9 @@ ofpact_check__(enum ofputil_protocol *usable_protocols, 
> struct ofpact *a,
>          * OpenFlow. */
>         return OFPERR_OFPBAC_BAD_TYPE;
> 
> +    case OFPACT_DEBUG_RECIRC:
> +        return 0;
> +
>     default:
>         OVS_NOT_REACHED();
>     }
> @@ -6061,6 +6121,7 @@ ofpact_outputs_to_port(const struct ofpact *ofpact, 
> ofp_port_t port)
>     case OFPACT_GOTO_TABLE:
>     case OFPACT_METER:
>     case OFPACT_GROUP:
> +    case OFPACT_DEBUG_RECIRC:
>     default:
>         return false;
>     }
> diff --git a/lib/ofp-actions.h b/lib/ofp-actions.h
> index 785c814..b26845d 100644
> --- a/lib/ofp-actions.h
> +++ b/lib/ofp-actions.h
> @@ -107,6 +107,12 @@
>     OFPACT(SAMPLE,          ofpact_sample,      ofpact, "sample")       \
>     OFPACT(UNROLL_XLATE,    ofpact_unroll_xlate, ofpact, "unroll_xlate") \
>                                                                         \
> +    /* Debugging actions.                                               \
> +     *                                                                  \
> +     * These are intentionally undocumented, subject to change, and     \
> +     * only accepted if ovs-vswitchd is started with --enable-dummy. */ \
> +    OFPACT(DEBUG_RECIRC, ofpact_null,           ofpact, "debug_recirc") \
> +                                                                        \
>     /* Instructions. */                                                 \
>     OFPACT(METER,           ofpact_meter,       ofpact, "meter")        \
>     OFPACT(CLEAR_ACTIONS,   ofpact_null,        ofpact, "clear_actions") \
> diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
> index 4315e30..68f4b37 100644
> --- a/ofproto/ofproto-dpif-xlate.c
> +++ b/ofproto/ofproto-dpif-xlate.c
> @@ -4086,6 +4086,7 @@ recirc_unroll_actions(const struct ofpact *ofpacts, 
> size_t ofpacts_len,
>         case OFPACT_WRITE_ACTIONS:
>         case OFPACT_METER:
>         case OFPACT_SAMPLE:
> +        case OFPACT_DEBUG_RECIRC:
>             break;
> 
>             /* These need not be copied for restoration. */
> @@ -4471,6 +4472,11 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t 
> ofpacts_len,
>         case OFPACT_SAMPLE:
>             xlate_sample_action(ctx, ofpact_get_SAMPLE(a));
>             break;
> +
> +        case OFPACT_DEBUG_RECIRC:
> +            ctx_trigger_recirculation(ctx);
> +            a = ofpact_next(a);
> +            break;
>         }
> 
>         /* Check if need to store this and the remaining actions for later
> -- 
> 2.1.3
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to