datapath: Harmonize [get|set]_skb_csum_pointers().
[openvswitch] / lib / ofp-util.c
index 1cafd862bac2cb9b8ac2641f105820a57cf48ca0..f99b2b65d9bb3b7db5c53dd0dc64e239df69cbaa 100644 (file)
@@ -127,10 +127,10 @@ ofputil_cls_rule_from_match(const struct ofp_match *match,
     wc->nw_dst_mask = ofputil_wcbits_to_netmask(ofpfw >> OFPFW_NW_DST_SHIFT);
 
     if (flow_format == NXFF_TUN_ID_FROM_COOKIE && !(ofpfw & NXFW_TUN_ID)) {
-        rule->flow.tun_id = htonl(ntohll(cookie) >> 32);
+        rule->flow.tun_id = htonll(ntohll(cookie) >> 32);
     } else {
         wc->wildcards |= FWW_TUN_ID;
-        rule->flow.tun_id = htonl(0);
+        rule->flow.tun_id = htonll(0);
     }
 
     if (ofpfw & OFPFW_DL_DST) {
@@ -233,7 +233,7 @@ ofputil_cls_rule_to_match(const struct cls_rule *rule,
             ofpfw |= NXFW_TUN_ID;
         } else {
             uint32_t cookie_lo = ntohll(cookie_in);
-            uint32_t cookie_hi = ntohl(rule->flow.tun_id);
+            uint32_t cookie_hi = ntohll(rule->flow.tun_id);
             cookie_in = htonll(cookie_lo | ((uint64_t) cookie_hi << 32));
         }
     }
@@ -362,7 +362,7 @@ ofputil_lookup_openflow_message(const struct ofputil_msg_category *cat,
         }
     }
 
-    VLOG_WARN_RL(&bad_ofmsg_rl, "received %s of unknown type %u",
+    VLOG_WARN_RL(&bad_ofmsg_rl, "received %s of unknown type %"PRIu32,
                  cat->name, value);
     return cat->missing_error;
 }
@@ -471,7 +471,7 @@ ofputil_decode_nxst_request(const struct ofp_header *oh,
     };
 
     static const struct ofputil_msg_category nxst_request_category = {
-        "Nicira extension statistics",
+        "Nicira extension statistics request",
         nxst_requests, ARRAY_SIZE(nxst_requests),
         OFP_MKERR(OFPET_BAD_REQUEST, OFPBRC_BAD_SUBTYPE)
     };
@@ -505,7 +505,7 @@ ofputil_decode_nxst_reply(const struct ofp_header *oh,
     };
 
     static const struct ofputil_msg_category nxst_reply_category = {
-        "Nicira extension statistics",
+        "Nicira extension statistics reply",
         nxst_replies, ARRAY_SIZE(nxst_replies),
         OFP_MKERR(OFPET_BAD_REQUEST, OFPBRC_BAD_SUBTYPE)
     };
@@ -856,7 +856,7 @@ ofputil_min_flow_format(const struct cls_rule *rule, bool cookie_support,
         || !regs_fully_wildcarded(wc)
         || (!(wc->wildcards & FWW_TUN_ID)
             && (!cookie_support
-                || (cookie_hi && cookie_hi != rule->flow.tun_id)))) {
+                || (cookie_hi && cookie_hi != ntohll(rule->flow.tun_id))))) {
         return NXFF_NXM;
     } else if (!(wc->wildcards & FWW_TUN_ID)) {
         return NXFF_TUN_ID_FROM_COOKIE;
@@ -1140,8 +1140,10 @@ ofputil_encode_flow_stats_request(const struct flow_stats_request *fsr,
     } else if (flow_format == NXFF_NXM) {
         struct nx_flow_stats_request *nfsr;
         int match_len;
+        int subtype;
 
-        ofputil_make_nxstats_request(sizeof *nfsr, NXST_FLOW, &msg);
+        subtype = fsr->aggregate ? NXST_AGGREGATE : NXST_FLOW;
+        ofputil_make_nxstats_request(sizeof *nfsr, subtype, &msg);
         match_len = nx_put_match(msg, &fsr->match);
 
         nfsr = msg->data;
@@ -1741,6 +1743,10 @@ check_nicira_action(const union ofp_action *a, unsigned int len,
     case NXAST_NOTE:
         return 0;
 
+    case NXAST_SET_TUNNEL64:
+        return check_action_exact_len(a, len,
+                                      sizeof(struct nx_action_set_tunnel64));
+
     case NXAST_SNAT__OBSOLETE:
     default:
         return ofp_mkerr(OFPET_BAD_ACTION, OFPBAC_BAD_VENDOR_TYPE);