X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ofproto%2Fofproto.c;h=8b52b80ade0757c01f024d828ff7114ba421d664;hb=d2bb2799e1b7cf2177140cf4ca8a60312c87625a;hp=86d0ae67715c33b41a5ccd84aaa511cb4d776a62;hpb=cdee00fd635d1e0f1eeb5d9c009daeb59abd4777;p=openvswitch diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 86d0ae67..8b52b80a 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -225,7 +225,7 @@ struct facet { bool installed; /* Installed in datapath? */ bool may_install; /* True ordinarily; false if actions must * be reassessed for every packet. */ - unsigned int actions_len; /* Number of bytes in actions[]. */ + size_t actions_len; /* Number of bytes in actions[]. */ struct nlattr *actions; /* Datapath actions. */ tag_type tags; /* Tags (set only by hooks). */ struct netflow_flow nf_flow; /* Per-flow NetFlow tracking data. */ @@ -2050,10 +2050,10 @@ rule_has_out_port(const struct rule *rule, ovs_be16 out_port) * Takes ownership of 'packet'. */ static bool execute_odp_actions(struct ofproto *ofproto, uint16_t in_port, - const struct nlattr *odp_actions, unsigned int actions_len, + const struct nlattr *odp_actions, size_t actions_len, struct ofpbuf *packet) { - if (actions_len == NLA_ALIGN(NLA_HDRLEN + sizeof(uint32_t)) + if (actions_len == NLA_ALIGN(NLA_HDRLEN + sizeof(uint64_t)) && odp_actions->nla_type == ODPAT_CONTROLLER) { /* As an optimization, avoid a round-trip from userspace to kernel to * userspace. This also avoids possibly filling up kernel packet @@ -2064,8 +2064,7 @@ execute_odp_actions(struct ofproto *ofproto, uint16_t in_port, msg->type = _ODPL_ACTION_NR; msg->length = sizeof(struct odp_msg) + packet->size; msg->port = in_port; - msg->reserved = 0; - msg->arg = nl_attr_get_u32(odp_actions); + msg->arg = nl_attr_get_u64(odp_actions); send_packet_in(ofproto, packet); @@ -2251,6 +2250,9 @@ facet_make_actions(struct ofproto *p, struct facet *facet, action_xlate_ctx_init(&ctx, p, &facet->flow, packet); odp_actions = xlate_actions(&ctx, rule->actions, rule->n_actions); + facet->tags = ctx.tags; + facet->may_install = ctx.may_set_up_flow; + facet->nf_flow.output_iface = ctx.nf_output_iface; if (facet->actions_len != odp_actions->size || memcmp(facet->actions, odp_actions->data, odp_actions->size)) { @@ -2476,8 +2478,6 @@ facet_revalidate(struct ofproto *ofproto, struct facet *facet) facet_flush_stats(ofproto, facet); } - ofpbuf_delete(odp_actions); - /* Update 'facet' now that we've taken care of all the old state. */ facet->tags = ctx.tags; facet->nf_flow.output_iface = ctx.nf_output_iface; @@ -2495,6 +2495,8 @@ facet_revalidate(struct ofproto *ofproto, struct facet *facet) facet->used = new_rule->created; } + ofpbuf_delete(odp_actions); + return true; } @@ -2734,7 +2736,7 @@ xlate_output_action__(struct action_xlate_ctx *ctx, &ctx->nf_output_iface, ctx->odp_actions); break; case OFPP_CONTROLLER: - nl_msg_put_u32(ctx->odp_actions, ODPAT_CONTROLLER, max_len); + nl_msg_put_u64(ctx->odp_actions, ODPAT_CONTROLLER, max_len); break; case OFPP_LOCAL: add_output_action(ctx, ODPP_LOCAL); @@ -2876,6 +2878,7 @@ xlate_nicira_action(struct action_xlate_ctx *ctx, const struct nx_action_set_tunnel *nast; const struct nx_action_set_queue *nasq; enum nx_action_subtype subtype = ntohs(nah->subtype); + ovs_be64 tun_id; assert(nah->vendor == htonl(NX_VENDOR_ID)); switch (subtype) { @@ -2886,8 +2889,9 @@ xlate_nicira_action(struct action_xlate_ctx *ctx, case NXAST_SET_TUNNEL: nast = (const struct nx_action_set_tunnel *) nah; - nl_msg_put_be32(ctx->odp_actions, ODPAT_SET_TUNNEL, nast->tun_id); - ctx->flow.tun_id = nast->tun_id; + tun_id = htonll(ntohl(nast->tun_id)); + nl_msg_put_be64(ctx->odp_actions, ODPAT_SET_TUNNEL, tun_id); + ctx->flow.tun_id = tun_id; break; case NXAST_DROP_SPOOFED_ARP: @@ -2917,6 +2921,12 @@ xlate_nicira_action(struct action_xlate_ctx *ctx, /* Nothing to do. */ break; + case NXAST_SET_TUNNEL64: + tun_id = ((const struct nx_action_set_tunnel64 *) nah)->tun_id; + nl_msg_put_be64(ctx->odp_actions, ODPAT_SET_TUNNEL, tun_id); + ctx->flow.tun_id = tun_id; + break; + /* If you add a new action here that modifies flow data, don't forget to * update the flow key in ctx->flow at the same time. */ @@ -3451,9 +3461,9 @@ put_ofp_flow_stats(struct ofconn *ofconn, struct rule *rule, ofs->length = htons(len); ofs->table_id = 0; ofs->pad = 0; - ofputil_cls_rule_to_match(&rule->cr, ofconn->flow_format, &ofs->match); + ofputil_cls_rule_to_match(&rule->cr, ofconn->flow_format, &ofs->match, + rule->flow_cookie, &ofs->cookie); calc_flow_duration(rule->created, &ofs->duration_sec, &ofs->duration_nsec); - ofs->cookie = rule->flow_cookie; ofs->priority = htons(rule->cr.priority); ofs->idle_timeout = htons(rule->idle_timeout); ofs->hard_timeout = htons(rule->hard_timeout); @@ -3575,19 +3585,17 @@ handle_nxst_flow(struct ofconn *ofconn, const struct ofp_header *oh) static void flow_stats_ds(struct ofproto *ofproto, struct rule *rule, struct ds *results) { - struct ofp_match match; uint64_t packet_count, byte_count; size_t act_len = sizeof *rule->actions * rule->n_actions; query_stats(ofproto, rule, &packet_count, &byte_count); - ofputil_cls_rule_to_match(&rule->cr, NXFF_OPENFLOW10, &match); ds_put_format(results, "duration=%llds, ", (time_msec() - rule->created) / 1000); ds_put_format(results, "priority=%u, ", rule->cr.priority); ds_put_format(results, "n_packets=%"PRIu64", ", packet_count); ds_put_format(results, "n_bytes=%"PRIu64", ", byte_count); - ofp_print_match(results, &match, true); + cls_rule_format(&rule->cr, results); if (act_len > 0) { ofp_print_actions(results, &rule->actions->header, act_len); } else { @@ -4671,8 +4679,8 @@ compose_ofp_flow_removed(struct ofconn *ofconn, const struct rule *rule, struct ofpbuf *buf; ofr = make_openflow(sizeof *ofr, OFPT_FLOW_REMOVED, &buf); - ofputil_cls_rule_to_match(&rule->cr, ofconn->flow_format, &ofr->match); - ofr->cookie = rule->flow_cookie; + ofputil_cls_rule_to_match(&rule->cr, ofconn->flow_format, &ofr->match, + rule->flow_cookie, &ofr->cookie); ofr->priority = htons(rule->cr.priority); ofr->reason = reason; calc_flow_duration(rule->created, &ofr->duration_sec, &ofr->duration_nsec);