]> git.droids-corp.org - dpdk.git/commitdiff
meter: unify packet color definition
authorReshma Pattan <reshma.pattan@intel.com>
Thu, 20 Dec 2018 12:16:08 +0000 (12:16 +0000)
committerCristian Dumitrescu <cristian.dumitrescu@intel.com>
Thu, 20 Dec 2018 18:00:10 +0000 (19:00 +0100)
Added new rte_color definition in librte_meter to
consolidate color definition which is currently replicated
in various places such as rte_meter.h, rte_tm.h and rte_mtr.h

Created aliases for rte_tm_color, rte_mtr_color and rte_meter_color
to use new rte_color values.

The definitions of rte_tm_color, rte_mtr_color and rte_meter_color
will be deprecated in future.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
lib/Makefile
lib/librte_ethdev/Makefile
lib/librte_ethdev/meson.build
lib/librte_ethdev/rte_mtr.h
lib/librte_ethdev/rte_tm.h
lib/librte_meter/rte_meter.h
lib/meson.build

index b7370ef97bdbff71122d74c234bc3372d695249b..8dbdc9bca31c332c816731f71b0af8713eb792e7 100644 (file)
@@ -26,6 +26,7 @@ DEPDIRS-librte_ethdev := librte_net librte_eal librte_mempool librte_ring
 DEPDIRS-librte_ethdev += librte_mbuf
 DEPDIRS-librte_ethdev += librte_kvargs
 DEPDIRS-librte_ethdev += librte_cmdline
+DEPDIRS-librte_ethdev += librte_meter
 DIRS-$(CONFIG_RTE_LIBRTE_BBDEV) += librte_bbdev
 DEPDIRS-librte_bbdev := librte_eal librte_mempool librte_mbuf
 DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += librte_cryptodev
index 3e27ae466fc79c5209c944ab71f2cf6b6746c0e4..e09c4263a015b904624be25e02c10713d4bf1038 100644 (file)
@@ -12,7 +12,7 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 LDLIBS += -lrte_net -lrte_eal -lrte_mempool -lrte_ring
-LDLIBS += -lrte_mbuf -lrte_kvargs -lrte_cmdline
+LDLIBS += -lrte_mbuf -lrte_kvargs -lrte_cmdline -lrte_meter
 
 EXPORT_MAP := rte_ethdev_version.map
 
index a4d8502682a7e39014eebb3b8c6cf7e9e4a2a30c..e98942ff882627f3a50f12951988abcbce37fbd5 100644 (file)
@@ -26,4 +26,4 @@ headers = files('rte_ethdev.h',
        'rte_tm.h',
        'rte_tm_driver.h')
 
-deps += ['net', 'kvargs', 'cmdline']
+deps += ['net', 'kvargs', 'cmdline', 'meter']
index c4819b274a03932ef769216f059ad6b347d8a7db..c667f87e19d5c49d18a6f2cc1fce90ee12bb15a2 100644 (file)
 #include <stdint.h>
 #include <rte_compat.h>
 #include <rte_common.h>
+#include <rte_meter.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/**
- * Color
- */
-enum rte_mtr_color {
-       RTE_MTR_GREEN = 0, /**< Green */
-       RTE_MTR_YELLOW, /**< Yellow */
-       RTE_MTR_RED, /**< Red */
-       RTE_MTR_COLORS /**< Number of colors. */
-};
+/* New rte_color is defined and used to deprecate rte_mtr_color soon. */
+#define rte_mtr_color rte_color
+#define RTE_MTR_GREEN RTE_COLOR_GREEN
+#define RTE_MTR_YELLOW RTE_COLOR_YELLOW
+#define RTE_MTR_RED RTE_COLOR_RED
+#define RTE_MTR_COLORS RTE_COLORS
 
 /**
  * Statistics counter type
index 646ef3880615a561c3f9beeb50118c58a6acb506..c4a788b8599123d0013378d8ad9b064f4c3ca108 100644 (file)
@@ -51,6 +51,7 @@
 #include <stdint.h>
 
 #include <rte_common.h>
+#include <rte_meter.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -115,15 +116,12 @@ extern "C" {
  */
 #define RTE_TM_NODE_LEVEL_ID_ANY                     UINT32_MAX
 
-/**
- * Color
- */
-enum rte_tm_color {
-       RTE_TM_GREEN = 0, /**< Green */
-       RTE_TM_YELLOW, /**< Yellow */
-       RTE_TM_RED, /**< Red */
-       RTE_TM_COLORS /**< Number of colors */
-};
+/* New rte_color is defined and used to deprecate rte_tm_color soon. */
+#define rte_tm_color rte_color
+#define RTE_TM_GREEN RTE_COLOR_GREEN
+#define RTE_TM_YELLOW RTE_COLOR_YELLOW
+#define RTE_TM_RED RTE_COLOR_RED
+#define RTE_TM_COLORS RTE_COLORS
 
 /**
  * Node statistics counter type
index 58a051583d2ace45d50870892287b04bf4429e80..c2ea47332e0ae691262b16e3736cceef7b4d7b76 100644 (file)
@@ -26,14 +26,23 @@ extern "C" {
  *
  ***/
 
-/** Packet Color Set */
-enum rte_meter_color {
-       e_RTE_METER_GREEN = 0, /**< Green */
-       e_RTE_METER_YELLOW,    /**< Yellow */
-       e_RTE_METER_RED,       /**< Red */
-       e_RTE_METER_COLORS     /**< Number of available colors */
+/**
+ * Color
+ */
+enum rte_color {
+       RTE_COLOR_GREEN = 0, /**< Green */
+       RTE_COLOR_YELLOW, /**< Yellow */
+       RTE_COLOR_RED, /**< Red */
+       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. */
index bb7f443f9421e2d72a61b103b3968567ffce2443..a2dd52e17a18b3cf185063d70372c23bd2b34596 100644 (file)
@@ -11,7 +11,7 @@
 libraries = [ 'compat', # just a header, used for versioning
        'cmdline', # ethdev depends on cmdline for parsing functions
        'kvargs', # eal depends on kvargs
-       'eal', 'ring', 'mempool', 'mbuf', 'net', 'ethdev', 'pci', # core
+       'eal', 'ring', 'mempool', 'mbuf', 'net', 'meter', 'ethdev', 'pci', # core
        'metrics', # bitrate/latency stats depends on this
        'hash',    # efd depends on this
        'timer',   # eventdev depends on this
@@ -20,7 +20,7 @@ libraries = [ 'compat', # just a header, used for versioning
        'distributor', 'efd', 'eventdev',
        'gro', 'gso', 'ip_frag', 'jobstats',
        'kni', 'latencystats', 'lpm', 'member',
-       'meter', 'power', 'pdump', 'rawdev',
+       'power', 'pdump', 'rawdev',
        'reorder', 'sched', 'security', 'vhost',
        # add pkt framework libs which use other libs from above
        'port', 'table', 'pipeline',