summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasvinder Singh <jasvinder.singh@intel.com>2018-09-26 14:08:45 +0100
committerCristian Dumitrescu <cristian.dumitrescu@intel.com>2018-10-12 17:59:09 +0200
commit9e800b908276ea76a70f678f5e9fb3308c7a0830 (patch)
treeb92128ff808c2dd99f4cf97b79a005b168a2d9d1
parent193de77b60b79cd15e41402339a151eb83d367d9 (diff)
downloaddpdk-9e800b908276ea76a70f678f5e9fb3308c7a0830.zip
dpdk-9e800b908276ea76a70f678f5e9fb3308c7a0830.tar.gz
dpdk-9e800b908276ea76a70f678f5e9fb3308c7a0830.tar.xz
net/softnic: support metering and policing
Enable metering and policing support for softnic. Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
-rw-r--r--drivers/net/softnic/Makefile1
-rw-r--r--drivers/net/softnic/meson.build1
-rw-r--r--drivers/net/softnic/rte_eth_softnic.c10
-rw-r--r--drivers/net/softnic/rte_eth_softnic_internals.h5
-rw-r--r--drivers/net/softnic/rte_eth_softnic_meter.c31
5 files changed, 48 insertions, 0 deletions
diff --git a/drivers/net/softnic/Makefile b/drivers/net/softnic/Makefile
index 12515b1..720f067b 100644
--- a/drivers/net/softnic/Makefile
+++ b/drivers/net/softnic/Makefile
@@ -34,6 +34,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_SOFTNIC) += rte_eth_softnic_pipeline.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_SOFTNIC) += rte_eth_softnic_thread.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_SOFTNIC) += rte_eth_softnic_cli.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_SOFTNIC) += rte_eth_softnic_flow.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_SOFTNIC) += rte_eth_softnic_meter.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_SOFTNIC) += parser.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_SOFTNIC) += conn.c
diff --git a/drivers/net/softnic/meson.build b/drivers/net/softnic/meson.build
index 56e5e2b..6b7a6cc 100644
--- a/drivers/net/softnic/meson.build
+++ b/drivers/net/softnic/meson.build
@@ -14,6 +14,7 @@ sources = files('rte_eth_softnic_tm.c',
'rte_eth_softnic_thread.c',
'rte_eth_softnic_cli.c',
'rte_eth_softnic_flow.c',
+ 'rte_eth_softnic_meter.c',
'parser.c',
'conn.c')
deps += ['pipeline', 'port', 'table', 'sched']
diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c
index 148b82e..25599ae 100644
--- a/drivers/net/softnic/rte_eth_softnic.c
+++ b/drivers/net/softnic/rte_eth_softnic.c
@@ -14,6 +14,7 @@
#include <rte_errno.h>
#include <rte_ring.h>
#include <rte_tm_driver.h>
+#include <rte_mtr_driver.h>
#include "rte_eth_softnic.h"
#include "rte_eth_softnic_internals.h"
@@ -227,6 +228,14 @@ pmd_tm_ops_get(struct rte_eth_dev *dev __rte_unused, void *arg)
return 0;
}
+static int
+pmd_mtr_ops_get(struct rte_eth_dev *dev __rte_unused, void *arg)
+{
+ *(const struct rte_mtr_ops **)arg = &pmd_mtr_ops;
+
+ return 0;
+}
+
static const struct eth_dev_ops pmd_ops = {
.dev_configure = pmd_dev_configure,
.dev_start = pmd_dev_start,
@@ -238,6 +247,7 @@ static const struct eth_dev_ops pmd_ops = {
.tx_queue_setup = pmd_tx_queue_setup,
.filter_ctrl = pmd_filter_ctrl,
.tm_ops_get = pmd_tm_ops_get,
+ .mtr_ops_get = pmd_mtr_ops_get,
};
static uint16_t
diff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h
index a1a2e15..92be4e8 100644
--- a/drivers/net/softnic/rte_eth_softnic_internals.h
+++ b/drivers/net/softnic/rte_eth_softnic_internals.h
@@ -572,6 +572,11 @@ flow_attr_map_get(struct pmd_internals *softnic,
extern const struct rte_flow_ops pmd_flow_ops;
/**
+ * Meter
+ */
+extern const struct rte_mtr_ops pmd_mtr_ops;
+
+/**
* MEMPOOL
*/
int
diff --git a/drivers/net/softnic/rte_eth_softnic_meter.c b/drivers/net/softnic/rte_eth_softnic_meter.c
new file mode 100644
index 0000000..0a5409b
--- /dev/null
+++ b/drivers/net/softnic/rte_eth_softnic_meter.c
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <rte_mtr.h>
+#include <rte_mtr_driver.h>
+
+#include "rte_eth_softnic_internals.h"
+
+const struct rte_mtr_ops pmd_mtr_ops = {
+ .capabilities_get = NULL,
+
+ .meter_profile_add = NULL,
+ .meter_profile_delete = NULL,
+
+ .create = NULL,
+ .destroy = NULL,
+ .meter_enable = NULL,
+ .meter_disable = NULL,
+
+ .meter_profile_update = NULL,
+ .meter_dscp_table_update = NULL,
+ .policer_actions_update = NULL,
+ .stats_update = NULL,
+
+ .stats_read = NULL,
+};