Update changelog for 18.02.1
[deb_dpdk.git] / examples / ip_pipeline / pipeline / pipeline_flow_classification.c
index 9ef50cc..d39e0fb 100644 (file)
@@ -1,34 +1,5 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of Intel Corporation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2016 Intel Corporation
  */
 
 #include <stdio.h>
@@ -88,8 +59,10 @@ app_pipeline_fc_key_convert(struct pipeline_fc_key *key_in,
        uint32_t *signature)
 {
        uint8_t buffer[PIPELINE_FC_FLOW_KEY_MAX_SIZE];
+       uint8_t m[PIPELINE_FC_FLOW_KEY_MAX_SIZE]; /* key mask */
        void *key_buffer = (key_out) ? key_out : buffer;
 
+       memset(m, 0xFF, sizeof(m));
        switch (key_in->type) {
        case FLOW_KEY_QINQ:
        {
@@ -101,7 +74,7 @@ app_pipeline_fc_key_convert(struct pipeline_fc_key *key_in,
                qinq->cvlan = rte_cpu_to_be_16(key_in->key.qinq.cvlan);
 
                if (signature)
-                       *signature = (uint32_t) hash_default_key8(qinq, 8, 0);
+                       *signature = (uint32_t) hash_default_key8(qinq, m, 8, 0);
                return 0;
        }
 
@@ -118,7 +91,7 @@ app_pipeline_fc_key_convert(struct pipeline_fc_key *key_in,
                ipv4->port_dst = rte_cpu_to_be_16(key_in->key.ipv4_5tuple.port_dst);
 
                if (signature)
-                       *signature = (uint32_t) hash_default_key16(ipv4, 16, 0);
+                       *signature = (uint32_t) hash_default_key16(ipv4, m, 16, 0);
                return 0;
        }
 
@@ -136,7 +109,7 @@ app_pipeline_fc_key_convert(struct pipeline_fc_key *key_in,
                ipv6->port_dst = rte_cpu_to_be_16(key_in->key.ipv6_5tuple.port_dst);
 
                if (signature)
-                       *signature = (uint32_t) hash_default_key64(ipv6, 64, 0);
+                       *signature = (uint32_t) hash_default_key64(ipv6, m, 64, 0);
                return 0;
        }
 
@@ -832,12 +805,12 @@ app_pipeline_fc_add_bulk(struct app_params *app,
        }
 
        /* Free resources */
-       app_msg_free(app, rsp);
 
        for (i = rsp->n_keys; i < n_keys; i++)
                if (new_flow[i])
                        rte_free(flow[i]);
 
+       app_msg_free(app, rsp);
        rte_free(flow_rsp);
        rte_free(flow_req);
        rte_free(new_flow);