summaryrefslogtreecommitdiff
path: root/lib/librte_meter
diff options
context:
space:
mode:
authorBruce Richardson <bruce.richardson@intel.com>2014-06-04 00:42:50 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2014-06-11 00:29:34 +0200
commit3031749c2df04a63cdcef186dcce3781e61436e8 (patch)
treee2ecf6d8ed4f7347ca4113fe00b77a0876a14246 /lib/librte_meter
parentd10296d7ea9c7e4f0da51ff2fb9c89b838e06940 (diff)
downloaddpdk-3031749c2df04a63cdcef186dcce3781e61436e8.zip
dpdk-3031749c2df04a63cdcef186dcce3781e61436e8.tar.gz
dpdk-3031749c2df04a63cdcef186dcce3781e61436e8.tar.xz
remove trailing whitespaces
This commit removes trailing whitespace from lines in files. Almost all files are affected, as the BSD license copyright header had trailing whitespace on 4 lines in it [hence the number of files reporting 8 lines changed in the diffstat]. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> [Thomas: remove spaces before tabs in libs] [Thomas: remove more trailing spaces in non-C files] Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Diffstat (limited to 'lib/librte_meter')
-rw-r--r--lib/librte_meter/Makefile8
-rw-r--r--lib/librte_meter/rte_meter.c30
-rw-r--r--lib/librte_meter/rte_meter.h66
3 files changed, 52 insertions, 52 deletions
diff --git a/lib/librte_meter/Makefile b/lib/librte_meter/Makefile
index 08740f5..b25c0cc 100644
--- a/lib/librte_meter/Makefile
+++ b/lib/librte_meter/Makefile
@@ -1,12 +1,12 @@
# BSD LICENSE
-#
+#
# Copyright(c) 2010-2014 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
@@ -16,7 +16,7 @@
# * 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
diff --git a/lib/librte_meter/rte_meter.c b/lib/librte_meter/rte_meter.c
index 94a7b40..5e2dadb 100644
--- a/lib/librte_meter/rte_meter.c
+++ b/lib/librte_meter/rte_meter.c
@@ -1,13 +1,13 @@
/*-
* BSD LICENSE
- *
+ *
* Copyright(c) 2010-2014 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
@@ -17,7 +17,7 @@
* * 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
@@ -49,7 +49,7 @@ static void
rte_meter_get_tb_params(uint64_t hz, uint64_t rate, uint64_t *tb_period, uint64_t *tb_bytes_per_period)
{
double period = ((double) hz) / ((double) rate);
-
+
if (period >= RTE_METER_TB_PERIOD_MIN) {
*tb_bytes_per_period = 1;
*tb_period = (uint64_t) period;
@@ -63,27 +63,27 @@ int
rte_meter_srtcm_config(struct rte_meter_srtcm *m, struct rte_meter_srtcm_params *params)
{
uint64_t hz;
-
+
/* Check input parameters */
if ((m == NULL) || (params == NULL)) {
return -1;
}
-
+
if ((params->cir == 0) || ((params->cbs == 0) && (params->ebs == 0))) {
return -2;
}
-
+
/* Initialize srTCM run-time structure */
hz = rte_get_tsc_hz();
m->time = rte_get_tsc_cycles();
m->tc = m->cbs = params->cbs;
m->te = m->ebs = params->ebs;
rte_meter_get_tb_params(hz, params->cir, &m->cir_period, &m->cir_bytes_per_period);
-
+
RTE_LOG(INFO, METER, "Low level srTCM config: \n"
"\tCIR period = %" PRIu64 ", CIR bytes per period = %" PRIu64 "\n",
m->cir_period, m->cir_bytes_per_period);
-
+
return 0;
}
@@ -91,17 +91,17 @@ int
rte_meter_trtcm_config(struct rte_meter_trtcm *m, struct rte_meter_trtcm_params *params)
{
uint64_t hz;
-
+
/* Check input parameters */
if ((m == NULL) || (params == NULL)) {
return -1;
}
-
+
if ((params->cir == 0) || (params->pir == 0) || (params->pir < params->cir) ||
(params->cbs == 0) || (params->pbs == 0)) {
return -2;
}
-
+
/* Initialize trTCM run-time structure */
hz = rte_get_tsc_hz();
m->time_tc = m->time_tp = rte_get_tsc_cycles();
@@ -109,12 +109,12 @@ rte_meter_trtcm_config(struct rte_meter_trtcm *m, struct rte_meter_trtcm_params
m->tp = m->pbs = params->pbs;
rte_meter_get_tb_params(hz, params->cir, &m->cir_period, &m->cir_bytes_per_period);
rte_meter_get_tb_params(hz, params->pir, &m->pir_period, &m->pir_bytes_per_period);
-
+
RTE_LOG(INFO, METER, "Low level trTCM config: \n"
"\tCIR period = %" PRIu64 ", CIR bytes per period = %" PRIu64 "\n"
"\tPIR period = %" PRIu64 ", PIR bytes per period = %" PRIu64 "\n",
m->cir_period, m->cir_bytes_per_period,
m->pir_period, m->pir_bytes_per_period);
-
+
return 0;
}
diff --git a/lib/librte_meter/rte_meter.h b/lib/librte_meter/rte_meter.h
index 0abe293..92728a5 100644
--- a/lib/librte_meter/rte_meter.h
+++ b/lib/librte_meter/rte_meter.h
@@ -1,13 +1,13 @@
/*-
* BSD LICENSE
- *
+ *
* Copyright(c) 2010-2014 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
@@ -17,7 +17,7 @@
* * 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
@@ -150,7 +150,7 @@ rte_meter_srtcm_color_blind_check(struct rte_meter_srtcm *m,
static inline enum rte_meter_color
rte_meter_srtcm_color_aware_check(struct rte_meter_srtcm *m,
uint64_t time,
- uint32_t pkt_len,
+ uint32_t pkt_len,
enum rte_meter_color pkt_color);
/**
@@ -194,7 +194,7 @@ rte_meter_trtcm_color_aware_check(struct rte_meter_trtcm *m,
* Inline implementation of run-time methods
*
***/
-
+
/* Internal data structure storing the srTCM run-time context per metered traffic flow. */
struct rte_meter_srtcm {
uint64_t time; /* Time of latest update of C and E token buckets */
@@ -221,38 +221,38 @@ struct rte_meter_trtcm {
};
static inline enum rte_meter_color
-rte_meter_srtcm_color_blind_check(struct rte_meter_srtcm *m,
+rte_meter_srtcm_color_blind_check(struct rte_meter_srtcm *m,
uint64_t time,
uint32_t pkt_len)
{
uint64_t time_diff, n_periods, tc, te;
-
+
/* Bucket update */
time_diff = time - m->time;
n_periods = time_diff / m->cir_period;
m->time += n_periods * m->cir_period;
-
+
tc = m->tc + n_periods * m->cir_bytes_per_period;
if (tc > m->cbs)
tc = m->cbs;
-
+
te = m->te + n_periods * m->cir_bytes_per_period;
if (te > m->ebs)
te = m->ebs;
-
+
/* Color logic */
if (tc >= pkt_len) {
m->tc = tc - pkt_len;
m->te = te;
return e_RTE_METER_GREEN;
}
-
+
if (te >= pkt_len) {
m->tc = tc;
m->te = te - pkt_len;
return e_RTE_METER_YELLOW;
}
-
+
m->tc = tc;
m->te = te;
return e_RTE_METER_RED;
@@ -261,37 +261,37 @@ rte_meter_srtcm_color_blind_check(struct rte_meter_srtcm *m,
static inline enum rte_meter_color
rte_meter_srtcm_color_aware_check(struct rte_meter_srtcm *m,
uint64_t time,
- uint32_t pkt_len,
+ uint32_t pkt_len,
enum rte_meter_color pkt_color)
{
uint64_t time_diff, n_periods, tc, te;
-
+
/* Bucket update */
time_diff = time - m->time;
n_periods = time_diff / m->cir_period;
m->time += n_periods * m->cir_period;
-
+
tc = m->tc + n_periods * m->cir_bytes_per_period;
if (tc > m->cbs)
tc = m->cbs;
-
+
te = m->te + n_periods * m->cir_bytes_per_period;
if (te > m->ebs)
te = m->ebs;
-
+
/* Color logic */
if ((pkt_color == e_RTE_METER_GREEN) && (tc >= pkt_len)) {
m->tc = tc - pkt_len;
m->te = te;
return e_RTE_METER_GREEN;
}
-
+
if ((pkt_color != e_RTE_METER_RED) && (te >= pkt_len)) {
m->tc = tc;
m->te = te - pkt_len;
return e_RTE_METER_YELLOW;
}
-
+
m->tc = tc;
m->te = te;
return e_RTE_METER_RED;
@@ -303,7 +303,7 @@ rte_meter_trtcm_color_blind_check(struct rte_meter_trtcm *m,
uint32_t pkt_len)
{
uint64_t time_diff_tc, time_diff_tp, n_periods_tc, n_periods_tp, tc, tp;
-
+
/* Bucket update */
time_diff_tc = time - m->time_tc;
time_diff_tp = time - m->time_tp;
@@ -311,28 +311,28 @@ rte_meter_trtcm_color_blind_check(struct rte_meter_trtcm *m,
n_periods_tp = time_diff_tp / m->pir_period;
m->time_tc += n_periods_tc * m->cir_period;
m->time_tp += n_periods_tp * m->pir_period;
-
+
tc = m->tc + n_periods_tc * m->cir_bytes_per_period;
if (tc > m->cbs)
tc = m->cbs;
-
+
tp = m->tp + n_periods_tp * m->pir_bytes_per_period;
if (tp > m->pbs)
tp = m->pbs;
-
+
/* Color logic */
if (tp < pkt_len) {
m->tc = tc;
m->tp = tp;
return e_RTE_METER_RED;
}
-
+
if (tc < pkt_len) {
m->tc = tc;
m->tp = tp - pkt_len;
return e_RTE_METER_YELLOW;
}
-
+
m->tc = tc - pkt_len;
m->tp = tp - pkt_len;
return e_RTE_METER_GREEN;
@@ -341,11 +341,11 @@ rte_meter_trtcm_color_blind_check(struct rte_meter_trtcm *m,
static inline enum rte_meter_color
rte_meter_trtcm_color_aware_check(struct rte_meter_trtcm *m,
uint64_t time,
- uint32_t pkt_len,
+ uint32_t pkt_len,
enum rte_meter_color pkt_color)
{
uint64_t time_diff_tc, time_diff_tp, n_periods_tc, n_periods_tp, tc, tp;
-
+
/* Bucket update */
time_diff_tc = time - m->time_tc;
time_diff_tp = time - m->time_tp;
@@ -353,28 +353,28 @@ rte_meter_trtcm_color_aware_check(struct rte_meter_trtcm *m,
n_periods_tp = time_diff_tp / m->pir_period;
m->time_tc += n_periods_tc * m->cir_period;
m->time_tp += n_periods_tp * m->pir_period;
-
+
tc = m->tc + n_periods_tc * m->cir_bytes_per_period;
if (tc > m->cbs)
tc = m->cbs;
-
+
tp = m->tp + n_periods_tp * m->pir_bytes_per_period;
if (tp > m->pbs)
tp = m->pbs;
-
+
/* Color logic */
if ((pkt_color == e_RTE_METER_RED) || (tp < pkt_len)) {
m->tc = tc;
m->tp = tp;
return e_RTE_METER_RED;
}
-
+
if ((pkt_color == e_RTE_METER_YELLOW) || (tc < pkt_len)) {
m->tc = tc;
m->tp = tp - pkt_len;
return e_RTE_METER_YELLOW;
}
-
+
m->tc = tc - pkt_len;
m->tp = tp - pkt_len;
return e_RTE_METER_GREEN;