From patchwork Wed Sep 26 13:08:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jasvinder Singh X-Patchwork-Id: 45395 X-Patchwork-Delegate: cristian.dumitrescu@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D8A105B2C; Wed, 26 Sep 2018 15:09:02 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 9E47D4CB3 for ; Wed, 26 Sep 2018 15:08:58 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Sep 2018 06:08:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,306,1534834800"; d="scan'208";a="93875407" Received: from silpixa00381635.ir.intel.com (HELO silpixa00381635.ger.corp.intel.com) ([10.237.222.149]) by orsmga001.jf.intel.com with ESMTP; 26 Sep 2018 06:08:55 -0700 From: Jasvinder Singh To: dev@dpdk.org Cc: cristian.dumitrescu@intel.com Date: Wed, 26 Sep 2018 14:08:45 +0100 Message-Id: <20180926130854.122474-2-jasvinder.singh@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180926130854.122474-1-jasvinder.singh@intel.com> References: <20180918165835.107593-2-jasvinder.singh@intel.com> <20180926130854.122474-1-jasvinder.singh@intel.com> Subject: [dpdk-dev] [PATCH v5 01/10] net/softnic: add metering and policing support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Enable metering and policing support for softnic. Signed-off-by: Jasvinder Singh --- drivers/net/softnic/Makefile | 1 + drivers/net/softnic/meson.build | 1 + drivers/net/softnic/rte_eth_softnic.c | 10 ++++++ .../net/softnic/rte_eth_softnic_internals.h | 5 +++ drivers/net/softnic/rte_eth_softnic_meter.c | 31 +++++++++++++++++++ 5 files changed, 48 insertions(+) create mode 100644 drivers/net/softnic/rte_eth_softnic_meter.c diff --git a/drivers/net/softnic/Makefile b/drivers/net/softnic/Makefile index 12515b10d..720f067bc 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 56e5e2b21..6b7a6ccf2 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 148b82ecb..25599aeea 100644 --- a/drivers/net/softnic/rte_eth_softnic.c +++ b/drivers/net/softnic/rte_eth_softnic.c @@ -14,6 +14,7 @@ #include #include #include +#include #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 a1a2e1558..92be4e8c1 100644 --- a/drivers/net/softnic/rte_eth_softnic_internals.h +++ b/drivers/net/softnic/rte_eth_softnic_internals.h @@ -571,6 +571,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 */ 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 000000000..0a5409b6e --- /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 +#include +#include + +#include +#include + +#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, +};