summaryrefslogtreecommitdiff
path: root/lib/librte_meter
diff options
context:
space:
mode:
authorJasvinder Singh <jasvinder.singh@intel.com>2019-04-11 10:15:14 +0100
committerThomas Monjalon <thomas@monjalon.net>2019-04-11 14:27:32 +0200
commitc1656328dbc20420b7ba87b1abee7b699c8e84f4 (patch)
treef675aee2cb241b21e1d88e474339e11485de666b /lib/librte_meter
parente3eb65cab308508883139b2b79c8348ec0682eec (diff)
downloaddpdk-c1656328dbc20420b7ba87b1abee7b699c8e84f4.zip
dpdk-c1656328dbc20420b7ba87b1abee7b699c8e84f4.tar.gz
dpdk-c1656328dbc20420b7ba87b1abee7b699c8e84f4.tar.xz
meter: replace color definitions
This patch implements the changes proposed in the deprecation note[1]. Replace multiple color definitions in various places such as rte_meter.h, rte_tm.h and rte_mtr.h with single rte_color defined in rte_meter.h. This is simple search and replace exercise without any implementation change. [1] https://mails.dpdk.org/archives/dev/2019-January/123861.html Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Diffstat (limited to 'lib/librte_meter')
-rw-r--r--lib/librte_meter/Makefile2
-rw-r--r--lib/librte_meter/meson.build2
-rw-r--r--lib/librte_meter/rte_meter.h91
3 files changed, 44 insertions, 51 deletions
diff --git a/lib/librte_meter/Makefile b/lib/librte_meter/Makefile
index 2dc071e..79ad797 100644
--- a/lib/librte_meter/Makefile
+++ b/lib/librte_meter/Makefile
@@ -16,7 +16,7 @@ LDLIBS += -lrte_eal
EXPORT_MAP := rte_meter_version.map
-LIBABIVER := 2
+LIBABIVER := 3
#
# all source are stored in SRCS-y
diff --git a/lib/librte_meter/meson.build b/lib/librte_meter/meson.build
index 947bc19..422123e 100644
--- a/lib/librte_meter/meson.build
+++ b/lib/librte_meter/meson.build
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2017 Intel Corporation
-version = 2
+version = 3
sources = files('rte_meter.c')
headers = files('rte_meter.h')
diff --git a/lib/librte_meter/rte_meter.h b/lib/librte_meter/rte_meter.h
index 005e4ee..3e383d2 100644
--- a/lib/librte_meter/rte_meter.h
+++ b/lib/librte_meter/rte_meter.h
@@ -40,13 +40,6 @@ enum rte_color {
RTE_COLORS /**< Number of colors */
};
-/* New rte_color is defined and used to deprecate rte_meter_color soon. */
-#define rte_meter_color rte_color
-#define e_RTE_METER_GREEN RTE_COLOR_GREEN
-#define e_RTE_METER_YELLOW RTE_COLOR_YELLOW
-#define e_RTE_METER_RED RTE_COLOR_RED
-#define e_RTE_METER_COLORS RTE_COLORS
-
/** srTCM parameters per metered traffic flow. The CIR, CBS and EBS parameters only
count bytes of IP packets and do not include link specific headers. At least one of
the CBS or EBS parameters has to be greater than zero. */
@@ -211,7 +204,7 @@ rte_meter_trtcm_rfc4115_config(struct rte_meter_trtcm_rfc4115 *m,
* @return
* Color assigned to the current IP packet
*/
-static inline enum rte_meter_color
+static inline enum rte_color
rte_meter_srtcm_color_blind_check(struct rte_meter_srtcm *m,
struct rte_meter_srtcm_profile *p,
uint64_t time,
@@ -233,12 +226,12 @@ rte_meter_srtcm_color_blind_check(struct rte_meter_srtcm *m,
* @return
* Color assigned to the current IP packet
*/
-static inline enum rte_meter_color
+static inline enum rte_color
rte_meter_srtcm_color_aware_check(struct rte_meter_srtcm *m,
struct rte_meter_srtcm_profile *p,
uint64_t time,
uint32_t pkt_len,
- enum rte_meter_color pkt_color);
+ enum rte_color pkt_color);
/**
* trTCM color blind traffic metering
@@ -254,7 +247,7 @@ rte_meter_srtcm_color_aware_check(struct rte_meter_srtcm *m,
* @return
* Color assigned to the current IP packet
*/
-static inline enum rte_meter_color
+static inline enum rte_color
rte_meter_trtcm_color_blind_check(struct rte_meter_trtcm *m,
struct rte_meter_trtcm_profile *p,
uint64_t time,
@@ -276,12 +269,12 @@ rte_meter_trtcm_color_blind_check(struct rte_meter_trtcm *m,
* @return
* Color assigned to the current IP packet
*/
-static inline enum rte_meter_color
+static inline enum rte_color
rte_meter_trtcm_color_aware_check(struct rte_meter_trtcm *m,
struct rte_meter_trtcm_profile *p,
uint64_t time,
uint32_t pkt_len,
- enum rte_meter_color pkt_color);
+ enum rte_color pkt_color);
/**
* @warning
@@ -300,7 +293,7 @@ rte_meter_trtcm_color_aware_check(struct rte_meter_trtcm *m,
* @return
* Color assigned to the current IP packet
*/
-static inline enum rte_meter_color __rte_experimental
+static inline enum rte_color __rte_experimental
rte_meter_trtcm_rfc4115_color_blind_check(
struct rte_meter_trtcm_rfc4115 *m,
struct rte_meter_trtcm_rfc4115_profile *p,
@@ -326,13 +319,13 @@ rte_meter_trtcm_rfc4115_color_blind_check(
* @return
* Color assigned to the current IP packet
*/
-static inline enum rte_meter_color __rte_experimental
+static inline enum rte_color __rte_experimental
rte_meter_trtcm_rfc4115_color_aware_check(
struct rte_meter_trtcm_rfc4115 *m,
struct rte_meter_trtcm_rfc4115_profile *p,
uint64_t time,
uint32_t pkt_len,
- enum rte_meter_color pkt_color);
+ enum rte_color pkt_color);
/*
* Inline implementation of run-time methods
@@ -417,7 +410,7 @@ struct rte_meter_trtcm_rfc4115 {
/**< Number of bytes currently available in the excess(E) token bucket */
};
-static inline enum rte_meter_color
+static inline enum rte_color
rte_meter_srtcm_color_blind_check(struct rte_meter_srtcm *m,
struct rte_meter_srtcm_profile *p,
uint64_t time,
@@ -444,26 +437,26 @@ rte_meter_srtcm_color_blind_check(struct rte_meter_srtcm *m,
if (tc >= pkt_len) {
m->tc = tc - pkt_len;
m->te = te;
- return e_RTE_METER_GREEN;
+ return RTE_COLOR_GREEN;
}
if (te >= pkt_len) {
m->tc = tc;
m->te = te - pkt_len;
- return e_RTE_METER_YELLOW;
+ return RTE_COLOR_YELLOW;
}
m->tc = tc;
m->te = te;
- return e_RTE_METER_RED;
+ return RTE_COLOR_RED;
}
-static inline enum rte_meter_color
+static inline enum rte_color
rte_meter_srtcm_color_aware_check(struct rte_meter_srtcm *m,
struct rte_meter_srtcm_profile *p,
uint64_t time,
uint32_t pkt_len,
- enum rte_meter_color pkt_color)
+ enum rte_color pkt_color)
{
uint64_t time_diff, n_periods, tc, te;
@@ -483,24 +476,24 @@ rte_meter_srtcm_color_aware_check(struct rte_meter_srtcm *m,
}
/* Color logic */
- if ((pkt_color == e_RTE_METER_GREEN) && (tc >= pkt_len)) {
+ if ((pkt_color == RTE_COLOR_GREEN) && (tc >= pkt_len)) {
m->tc = tc - pkt_len;
m->te = te;
- return e_RTE_METER_GREEN;
+ return RTE_COLOR_GREEN;
}
- if ((pkt_color != e_RTE_METER_RED) && (te >= pkt_len)) {
+ if ((pkt_color != RTE_COLOR_RED) && (te >= pkt_len)) {
m->tc = tc;
m->te = te - pkt_len;
- return e_RTE_METER_YELLOW;
+ return RTE_COLOR_YELLOW;
}
m->tc = tc;
m->te = te;
- return e_RTE_METER_RED;
+ return RTE_COLOR_RED;
}
-static inline enum rte_meter_color
+static inline enum rte_color
rte_meter_trtcm_color_blind_check(struct rte_meter_trtcm *m,
struct rte_meter_trtcm_profile *p,
uint64_t time,
@@ -528,26 +521,26 @@ rte_meter_trtcm_color_blind_check(struct rte_meter_trtcm *m,
if (tp < pkt_len) {
m->tc = tc;
m->tp = tp;
- return e_RTE_METER_RED;
+ return RTE_COLOR_RED;
}
if (tc < pkt_len) {
m->tc = tc;
m->tp = tp - pkt_len;
- return e_RTE_METER_YELLOW;
+ return RTE_COLOR_YELLOW;
}
m->tc = tc - pkt_len;
m->tp = tp - pkt_len;
- return e_RTE_METER_GREEN;
+ return RTE_COLOR_GREEN;
}
-static inline enum rte_meter_color
+static inline enum rte_color
rte_meter_trtcm_color_aware_check(struct rte_meter_trtcm *m,
struct rte_meter_trtcm_profile *p,
uint64_t time,
uint32_t pkt_len,
- enum rte_meter_color pkt_color)
+ enum rte_color pkt_color)
{
uint64_t time_diff_tc, time_diff_tp, n_periods_tc, n_periods_tp, tc, tp;
@@ -568,24 +561,24 @@ rte_meter_trtcm_color_aware_check(struct rte_meter_trtcm *m,
tp = p->pbs;
/* Color logic */
- if ((pkt_color == e_RTE_METER_RED) || (tp < pkt_len)) {
+ if ((pkt_color == RTE_COLOR_RED) || (tp < pkt_len)) {
m->tc = tc;
m->tp = tp;
- return e_RTE_METER_RED;
+ return RTE_COLOR_RED;
}
- if ((pkt_color == e_RTE_METER_YELLOW) || (tc < pkt_len)) {
+ if ((pkt_color == RTE_COLOR_YELLOW) || (tc < pkt_len)) {
m->tc = tc;
m->tp = tp - pkt_len;
- return e_RTE_METER_YELLOW;
+ return RTE_COLOR_YELLOW;
}
m->tc = tc - pkt_len;
m->tp = tp - pkt_len;
- return e_RTE_METER_GREEN;
+ return RTE_COLOR_GREEN;
}
-static inline enum rte_meter_color __rte_experimental
+static inline enum rte_color __rte_experimental
rte_meter_trtcm_rfc4115_color_blind_check(
struct rte_meter_trtcm_rfc4115 *m,
struct rte_meter_trtcm_rfc4115_profile *p,
@@ -614,27 +607,27 @@ rte_meter_trtcm_rfc4115_color_blind_check(
if (tc >= pkt_len) {
m->tc = tc - pkt_len;
m->te = te;
- return e_RTE_METER_GREEN;
+ return RTE_COLOR_GREEN;
}
if (te >= pkt_len) {
m->tc = tc;
m->te = te - pkt_len;
- return e_RTE_METER_YELLOW;
+ return RTE_COLOR_YELLOW;
}
/* If we end up here the color is RED */
m->tc = tc;
m->te = te;
- return e_RTE_METER_RED;
+ return RTE_COLOR_RED;
}
-static inline enum rte_meter_color __rte_experimental
+static inline enum rte_color __rte_experimental
rte_meter_trtcm_rfc4115_color_aware_check(
struct rte_meter_trtcm_rfc4115 *m,
struct rte_meter_trtcm_rfc4115_profile *p,
uint64_t time,
uint32_t pkt_len,
- enum rte_meter_color pkt_color)
+ enum rte_color pkt_color)
{
uint64_t time_diff_tc, time_diff_te, n_periods_tc, n_periods_te, tc, te;
@@ -655,22 +648,22 @@ rte_meter_trtcm_rfc4115_color_aware_check(
te = p->ebs;
/* Color logic */
- if ((pkt_color == e_RTE_METER_GREEN) && (tc >= pkt_len)) {
+ if ((pkt_color == RTE_COLOR_GREEN) && (tc >= pkt_len)) {
m->tc = tc - pkt_len;
m->te = te;
- return e_RTE_METER_GREEN;
+ return RTE_COLOR_GREEN;
}
- if ((pkt_color != e_RTE_METER_RED) && (te >= pkt_len)) {
+ if ((pkt_color != RTE_COLOR_RED) && (te >= pkt_len)) {
m->tc = tc;
m->te = te - pkt_len;
- return e_RTE_METER_YELLOW;
+ return RTE_COLOR_YELLOW;
}
/* If we end up here the color is RED */
m->tc = tc;
m->te = te;
- return e_RTE_METER_RED;
+ return RTE_COLOR_RED;
}