[ovs-dev] [PATCH] flow: Rename 'priority' to 'skb_priority'.

Ben Pfaff blp at nicira.com
Wed Dec 21 23:53:23 UTC 2011


Thanks.  I added that to the commit log and pushed.

On Wed, Dec 21, 2011 at 03:51:35PM -0800, Justin Pettit wrote:
> Looks good.  We should be on the lookout for a less Linux-specific name, but it seems fine for now.
> 
> --Justin
> 
> 
> On Dec 21, 2011, at 3:40 PM, Ben Pfaff wrote:
> 
> > This priority's mean is completely different from the priority of an
> > OpenFlow rule, so it is confusing for it to have the same name.
> > 
> > Signed-off-by: Ben Pfaff <blp at nicira.com>
> > ---
> > lib/classifier.c       |    2 +-
> > lib/flow.c             |   12 +++++++-----
> > lib/flow.h             |    2 +-
> > lib/odp-util.c         |   12 ++++++------
> > ofproto/ofproto-dpif.c |   18 +++++++++---------
> > 5 files changed, 24 insertions(+), 22 deletions(-)
> > 
> > diff --git a/lib/classifier.c b/lib/classifier.c
> > index dab8f62..26751ca 100644
> > --- a/lib/classifier.c
> > +++ b/lib/classifier.c
> > @@ -74,7 +74,7 @@ cls_rule_init_exact(const struct flow *flow,
> >                     unsigned int priority, struct cls_rule *rule)
> > {
> >     rule->flow = *flow;
> > -    rule->flow.priority = 0;
> > +    rule->flow.skb_priority = 0;
> >     flow_wildcards_init_exact(&rule->wc);
> >     rule->priority = priority;
> > }
> > diff --git a/lib/flow.c b/lib/flow.c
> > index 922412f..fa7ae4f 100644
> > --- a/lib/flow.c
> > +++ b/lib/flow.c
> > @@ -312,7 +312,9 @@ invalid:
> > 
> > }
> > 
> > -/* Initializes 'flow' members from 'packet', 'tun_id', and 'ofp_in_port'.
> > +/* Initializes 'flow' members from 'packet', 'skb_priority', 'tun_id', and
> > + * 'ofp_in_port'.
> > + *
> >  * Initializes 'packet' header pointers as follows:
> >  *
> >  *    - packet->l2 to the start of the Ethernet header.
> > @@ -328,7 +330,7 @@ invalid:
> >  *      present and has a correct length, and otherwise NULL.
> >  */
> > void
> > -flow_extract(struct ofpbuf *packet, uint32_t priority, ovs_be64 tun_id,
> > +flow_extract(struct ofpbuf *packet, uint32_t skb_priority, ovs_be64 tun_id,
> >              uint16_t ofp_in_port, struct flow *flow)
> > {
> >     struct ofpbuf b = *packet;
> > @@ -339,7 +341,7 @@ flow_extract(struct ofpbuf *packet, uint32_t priority, ovs_be64 tun_id,
> >     memset(flow, 0, sizeof *flow);
> >     flow->tun_id = tun_id;
> >     flow->in_port = ofp_in_port;
> > -    flow->priority = priority;
> > +    flow->skb_priority = skb_priority;
> > 
> >     packet->l2 = b.data;
> >     packet->l3 = NULL;
> > @@ -502,7 +504,7 @@ flow_zero_wildcards(struct flow *flow, const struct flow_wildcards *wildcards)
> >     if (wc & FWW_ND_TARGET) {
> >         memset(&flow->nd_target, 0, sizeof flow->nd_target);
> >     }
> > -    flow->priority = 0;
> > +    flow->skb_priority = 0;
> > }
> > 
> > char *
> > @@ -519,7 +521,7 @@ flow_format(struct ds *ds, const struct flow *flow)
> >     ds_put_format(ds, "priority%"PRIu32
> >                       ":tunnel%#"PRIx64
> >                       ":in_port%04"PRIx16,
> > -                      flow->priority,
> > +                      flow->skb_priority,
> >                       ntohll(flow->tun_id),
> >                       flow->in_port);
> > 
> > diff --git a/lib/flow.h b/lib/flow.h
> > index 7606cb3..32492e8 100644
> > --- a/lib/flow.h
> > +++ b/lib/flow.h
> > @@ -57,7 +57,7 @@ struct flow {
> >     struct in6_addr ipv6_src;   /* IPv6 source address. */
> >     struct in6_addr ipv6_dst;   /* IPv6 destination address. */
> >     struct in6_addr nd_target;  /* IPv6 neighbor discovery (ND) target. */
> > -    uint32_t priority;          /* Packet priority for QoS. */
> > +    uint32_t skb_priority;      /* Packet priority for QoS. */
> >     uint32_t regs[FLOW_N_REGS]; /* Registers. */
> >     ovs_be32 nw_src;            /* IPv4 source address. */
> >     ovs_be32 nw_dst;            /* IPv4 destination address. */
> > diff --git a/lib/odp-util.c b/lib/odp-util.c
> > index ee1c378..490d35e 100644
> > --- a/lib/odp-util.c
> > +++ b/lib/odp-util.c
> > @@ -1163,8 +1163,8 @@ odp_flow_key_from_flow(struct ofpbuf *buf, const struct flow *flow)
> >     struct ovs_key_ethernet *eth_key;
> >     size_t encap;
> > 
> > -    if (flow->priority) {
> > -        nl_msg_put_u32(buf, OVS_KEY_ATTR_PRIORITY, flow->priority);
> > +    if (flow->skb_priority) {
> > +        nl_msg_put_u32(buf, OVS_KEY_ATTR_PRIORITY, flow->skb_priority);
> >     }
> > 
> >     if (flow->tun_id != htonll(0)) {
> > @@ -1655,7 +1655,7 @@ odp_flow_key_to_flow(const struct nlattr *key, size_t key_len,
> > 
> >     /* Metadata. */
> >     if (present_attrs & (UINT64_C(1) << OVS_KEY_ATTR_PRIORITY)) {
> > -        flow->priority = nl_attr_get_u32(attrs[OVS_KEY_ATTR_PRIORITY]);
> > +        flow->skb_priority = nl_attr_get_u32(attrs[OVS_KEY_ATTR_PRIORITY]);
> >         expected_attrs |= UINT64_C(1) << OVS_KEY_ATTR_PRIORITY;
> >     }
> > 
> > @@ -1859,13 +1859,13 @@ static void
> > commit_set_priority_action(const struct flow *flow, struct flow *base,
> >                            struct ofpbuf *odp_actions)
> > {
> > -    if (base->priority == flow->priority) {
> > +    if (base->skb_priority == flow->skb_priority) {
> >         return;
> >     }
> > -    base->priority = flow->priority;
> > +    base->skb_priority = flow->skb_priority;
> > 
> >     commit_set_action(odp_actions, OVS_KEY_ATTR_PRIORITY,
> > -                      &base->priority, sizeof(base->priority));
> > +                      &base->skb_priority, sizeof(base->skb_priority));
> > }
> > 
> > /* If any of the flow key data that ODP actions can modify are different in
> > diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> > index 7dc8cae..56c3baf 100644
> > --- a/ofproto/ofproto-dpif.c
> > +++ b/ofproto/ofproto-dpif.c
> > @@ -227,7 +227,7 @@ struct action_xlate_ctx {
> > 
> >     int recurse;                /* Recursion level, via xlate_table_action. */
> >     struct flow base_flow;      /* Flow at the last commit. */
> > -    uint32_t original_priority; /* Priority when packet arrived. */
> > +    uint32_t orig_skb_priority; /* Priority when packet arrived. */
> >     uint8_t table_id;           /* OpenFlow table ID where flow was found. */
> >     uint32_t sflow_n_outputs;   /* Number of output ports. */
> >     uint16_t sflow_odp_port;    /* Output port for composing sFlow action. */
> > @@ -2673,7 +2673,7 @@ handle_miss_upcalls(struct ofproto_dpif *ofproto, struct dpif_upcall *upcalls,
> >             ofpbuf_delete(upcall->packet);
> >             continue;
> >         }
> > -        flow_extract(upcall->packet, flow.priority, flow.tun_id,
> > +        flow_extract(upcall->packet, flow.skb_priority, flow.tun_id,
> >                      flow.in_port, &flow);
> > 
> >         /* Handle 802.1ag, LACP, and STP specially. */
> > @@ -4161,7 +4161,7 @@ compose_output_action__(struct action_xlate_ctx *ctx, uint16_t ofp_port,
> >             return;
> >         }
> > 
> > -        pdscp = get_priority(ofport, ctx->flow.priority);
> > +        pdscp = get_priority(ofport, ctx->flow.skb_priority);
> >         if (pdscp) {
> >             ctx->flow.nw_tos &= ~IP_DSCP_MASK;
> >             ctx->flow.nw_tos |= pdscp->dscp;
> > @@ -4390,10 +4390,10 @@ xlate_enqueue_action(struct action_xlate_ctx *ctx,
> >     }
> > 
> >     /* Add datapath actions. */
> > -    flow_priority = ctx->flow.priority;
> > -    ctx->flow.priority = priority;
> > +    flow_priority = ctx->flow.skb_priority;
> > +    ctx->flow.skb_priority = priority;
> >     compose_output_action(ctx, ofp_port);
> > -    ctx->flow.priority = flow_priority;
> > +    ctx->flow.skb_priority = flow_priority;
> > 
> >     /* Update NetFlow output port. */
> >     if (ctx->nf_output_iface == NF_OUT_DROP) {
> > @@ -4418,7 +4418,7 @@ xlate_set_queue_action(struct action_xlate_ctx *ctx,
> >         return;
> >     }
> > 
> > -    ctx->flow.priority = priority;
> > +    ctx->flow.skb_priority = priority;
> > }
> > 
> > struct xlate_reg_state {
> > @@ -4616,7 +4616,7 @@ do_xlate_actions(const union ofp_action *in, size_t n_in,
> >             break;
> > 
> >         case OFPUTIL_NXAST_POP_QUEUE:
> > -            ctx->flow.priority = ctx->original_priority;
> > +            ctx->flow.skb_priority = ctx->orig_skb_priority;
> >             break;
> > 
> >         case OFPUTIL_NXAST_REG_MOVE:
> > @@ -4721,7 +4721,7 @@ xlate_actions(struct action_xlate_ctx *ctx,
> >     ctx->nf_output_iface = NF_OUT_DROP;
> >     ctx->mirrors = 0;
> >     ctx->recurse = 0;
> > -    ctx->original_priority = ctx->flow.priority;
> > +    ctx->orig_skb_priority = ctx->flow.skb_priority;
> >     ctx->table_id = 0;
> >     ctx->exit = false;
> > 
> > -- 
> > 1.7.2.5
> > 
> > _______________________________________________
> > dev mailing list
> > dev at openvswitch.org
> > http://openvswitch.org/mailman/listinfo/dev
> 



More information about the dev mailing list