[ovs-dev] [reordering 3/7] ofproto-dpif-upcall: Remove redundant 'packets' list from struct flow_miss.

Jarno Rajahalme jrajahalme at nicira.com
Tue Sep 17 19:25:27 UTC 2013


Acked-by: Jarno Rajahalme <jrajahalme at nicira.com>

On Sep 16, 2013, at 2:59 PM, Ben Pfaff <blp at nicira.com> wrote:

> Until now, struct flow_miss contained a list of packets and a list of
> upcalls.  Each packet in the list of packets can be obtained from the
> corresponding upcall in the list of upcalls via upcall->dpif_upcall.packet,
> so this commit deletes the list of packets and replaces each reference to
> a packet by that expression.
> 
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
> ofproto/ofproto-dpif-upcall.c |   18 ++++++++++--------
> ofproto/ofproto-dpif-upcall.h |    3 +--
> ofproto/ofproto-dpif.c        |    4 ++--
> 3 files changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
> index bc1e884..b9d91b2 100644
> --- a/ofproto/ofproto-dpif-upcall.c
> +++ b/ofproto/ofproto-dpif-upcall.c
> @@ -604,14 +604,16 @@ static void
> execute_flow_miss(struct flow_miss *miss, struct dpif_op *ops, size_t *n_ops)
> {
>     struct ofproto_dpif *ofproto = miss->ofproto;
> +    struct upcall *upcall;
>     struct flow_wildcards wc;
>     struct rule_dpif *rule;
> -    struct ofpbuf *packet;
>     struct xlate_in xin;
> 
>     memset(&miss->stats, 0, sizeof miss->stats);
>     miss->stats.used = time_msec();
> -    LIST_FOR_EACH (packet, list_node, &miss->packets) {
> +    LIST_FOR_EACH (upcall, list_node, &miss->upcalls) {
> +        struct ofpbuf *packet = upcall->dpif_upcall.packet;
> +
>         miss->stats.tcp_flags |= packet_get_tcp_flags(packet, &miss->flow);
>         miss->stats.n_bytes += packet->size;
>         miss->stats.n_packets++;
> @@ -628,7 +630,8 @@ execute_flow_miss(struct flow_miss *miss, struct dpif_op *ops, size_t *n_ops)
>     flow_wildcards_or(&miss->xout.wc, &miss->xout.wc, &wc);
> 
>     if (rule_dpif_fail_open(rule)) {
> -        LIST_FOR_EACH (packet, list_node, &miss->packets) {
> +        LIST_FOR_EACH (upcall, list_node, &miss->upcalls) {
> +            struct ofpbuf *packet = upcall->dpif_upcall.packet;
>             struct ofputil_packet_in *pin;
> 
>             /* Extra-special case for fail-open mode.
> @@ -653,7 +656,8 @@ execute_flow_miss(struct flow_miss *miss, struct dpif_op *ops, size_t *n_ops)
>     }
> 
>     if (miss->xout.slow) {
> -        LIST_FOR_EACH (packet, list_node, &miss->packets) {
> +        LIST_FOR_EACH (upcall, list_node, &miss->upcalls) {
> +            struct ofpbuf *packet = upcall->dpif_upcall.packet;
>             struct xlate_in xin;
> 
>             xlate_in_init(&xin, miss->ofproto, &miss->flow, rule, 0, packet);
> @@ -663,7 +667,8 @@ execute_flow_miss(struct flow_miss *miss, struct dpif_op *ops, size_t *n_ops)
>     rule_dpif_unref(rule);
> 
>     if (miss->xout.odp_actions.size) {
> -        LIST_FOR_EACH (packet, list_node, &miss->packets) {
> +        LIST_FOR_EACH (upcall, list_node, &miss->upcalls) {
> +            struct ofpbuf *packet = upcall->dpif_upcall.packet;
>             struct dpif_op *op = &ops[*n_ops];
>             struct dpif_execute *execute = &op->u.execute;
> 
> @@ -766,15 +771,12 @@ handle_miss_upcalls(struct udpif *udpif, struct list *upcalls)
>             miss->key = dupcall->key;
>             miss->key_len = dupcall->key_len;
>             miss->upcall_type = dupcall->type;
> -            list_init(&miss->packets);
>             list_init(&miss->upcalls);
> 
>             n_upcalls++;
>         } else {
>             miss = existing_miss;
>         }
> -        list_push_back(&miss->packets, &dupcall->packet->list_node);
> -
>         list_remove(&upcall->list_node);
>         list_push_back(&miss->upcalls, &upcall->list_node);
>     }
> diff --git a/ofproto/ofproto-dpif-upcall.h b/ofproto/ofproto-dpif-upcall.h
> index 57d462d..a23f7a0 100644
> --- a/ofproto/ofproto-dpif-upcall.h
> +++ b/ofproto/ofproto-dpif-upcall.h
> @@ -90,13 +90,12 @@ struct flow_miss {
>     enum odp_key_fitness key_fitness;
>     const struct nlattr *key;
>     size_t key_len;
> -    struct list packets;
>     enum dpif_upcall_type upcall_type;
>     struct dpif_flow_stats stats;
> 
>     struct xlate_out xout;
> 
> -    struct list upcalls;
> +    struct list upcalls;        /* Contains "struct upcall"s. */
> };
> 
> struct flow_miss_batch {
> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> index 28dc661..19f69e2 100644
> --- a/ofproto/ofproto-dpif.c
> +++ b/ofproto/ofproto-dpif.c
> @@ -3242,7 +3242,7 @@ flow_miss_should_make_facet(struct flow_miss *miss)
> 
>     hash = flow_hash_in_wildcards(&miss->flow, &miss->xout.wc, 0);
>     return governor_should_install_flow(backer->governor, hash,
> -                                        list_size(&miss->packets));
> +                                        list_size(&miss->upcalls));
> }
> 
> /* Handles 'miss', which matches 'facet'.  May add any required datapath
> @@ -3320,7 +3320,7 @@ handle_flow_miss(struct flow_miss *miss, struct flow_miss_op *ops,
> {
>     struct facet *facet;
> 
> -    miss->ofproto->n_missed += list_size(&miss->packets);
> +    miss->ofproto->n_missed += list_size(&miss->upcalls);
> 
>     facet = facet_lookup_valid(miss->ofproto, &miss->flow);
>     if (!facet) {
> -- 
> 1.7.10.4
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev




More information about the dev mailing list