From patchwork Thu Sep 6 16:26:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pattan, Reshma" X-Patchwork-Id: 44333 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 2A5064D3A; Thu, 6 Sep 2018 18:27:11 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 80C1F4C9D for ; Thu, 6 Sep 2018 18:27:08 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Sep 2018 09:27:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,338,1531810800"; d="scan'208";a="68064422" Received: from sivswdev02.ir.intel.com (HELO localhost.localdomain) ([10.237.217.46]) by fmsmga007.fm.intel.com with ESMTP; 06 Sep 2018 09:27:06 -0700 From: Reshma Pattan To: dev@dpdk.org Cc: Cristian Dumitrescu , Reshma Pattan Date: Thu, 6 Sep 2018 17:26:49 +0100 Message-Id: <1536251222-17275-3-git-send-email-reshma.pattan@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1536251222-17275-1-git-send-email-reshma.pattan@intel.com> References: <1536251222-17275-1-git-send-email-reshma.pattan@intel.com> Subject: [dpdk-dev] [PATCH 02/15] net/softnic: rte flow attr mapping to pipeline 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" Added mapping support from rte flow attributes to softnic pipeline and table. So added flow attribute map set and get functions definition to new file rte_eth_sofnic_flow.c. Added pmd flow internals with ingress and egress flow attribute maps. Signed-off-by: Cristian Dumitrescu Signed-off-by: Reshma Pattan --- drivers/net/softnic/Makefile | 1 + drivers/net/softnic/meson.build | 1 + drivers/net/softnic/rte_eth_softnic_flow.c | 46 +++++++++++++++++++++++++ drivers/net/softnic/rte_eth_softnic_internals.h | 31 +++++++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 drivers/net/softnic/rte_eth_softnic_flow.c diff --git a/drivers/net/softnic/Makefile b/drivers/net/softnic/Makefile index ea9b65f4e..12515b10d 100644 --- a/drivers/net/softnic/Makefile +++ b/drivers/net/softnic/Makefile @@ -33,6 +33,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_SOFTNIC) += rte_eth_softnic_action.c 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) += 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 ff9822747..56e5e2b21 100644 --- a/drivers/net/softnic/meson.build +++ b/drivers/net/softnic/meson.build @@ -13,6 +13,7 @@ sources = files('rte_eth_softnic_tm.c', 'rte_eth_softnic_pipeline.c', 'rte_eth_softnic_thread.c', 'rte_eth_softnic_cli.c', + 'rte_eth_softnic_flow.c', 'parser.c', 'conn.c') deps += ['pipeline', 'port', 'table', 'sched'] diff --git a/drivers/net/softnic/rte_eth_softnic_flow.c b/drivers/net/softnic/rte_eth_softnic_flow.c new file mode 100644 index 000000000..843db7590 --- /dev/null +++ b/drivers/net/softnic/rte_eth_softnic_flow.c @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017 Intel Corporation + */ + +#include "rte_eth_softnic_internals.h" +#include "rte_eth_softnic.h" + +int +flow_attr_map_set(struct pmd_internals *softnic, + uint32_t group_id, + int ingress, + const char *pipeline_name, + uint32_t table_id) +{ + struct pipeline *pipeline; + struct flow_attr_map *map; + + if (group_id >= SOFTNIC_FLOW_MAX_GROUPS || + pipeline_name == NULL) + return -1; + + pipeline = softnic_pipeline_find(softnic, pipeline_name); + if (pipeline == NULL || + table_id >= pipeline->n_tables) + return -1; + + map = (ingress) ? &softnic->flow.ingress_map[group_id] : + &softnic->flow.egress_map[group_id]; + strcpy(map->pipeline_name, pipeline_name); + map->table_id = table_id; + map->valid = 1; + + return 0; +} + +struct flow_attr_map * +flow_attr_map_get(struct pmd_internals *softnic, + uint32_t group_id, + int ingress) +{ + if (group_id >= SOFTNIC_FLOW_MAX_GROUPS) + return NULL; + + return (ingress) ? &softnic->flow.ingress_map[group_id] : + &softnic->flow.egress_map[group_id]; +} diff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h index 882cfd191..d1996c469 100644 --- a/drivers/net/softnic/rte_eth_softnic_internals.h +++ b/drivers/net/softnic/rte_eth_softnic_internals.h @@ -51,6 +51,21 @@ struct rte_flow; TAILQ_HEAD(flow_list, rte_flow); +struct flow_attr_map { + char pipeline_name[NAME_SIZE]; + uint32_t table_id; + int valid; +}; + +#ifndef SOFTNIC_FLOW_MAX_GROUPS +#define SOFTNIC_FLOW_MAX_GROUPS 64 +#endif + +struct flow_internals { + struct flow_attr_map ingress_map[SOFTNIC_FLOW_MAX_GROUPS]; + struct flow_attr_map egress_map[SOFTNIC_FLOW_MAX_GROUPS]; +}; + /** * MEMPOOL */ @@ -497,6 +512,7 @@ struct pmd_internals { struct tm_internals tm; /**< Traffic Management */ } soft; + struct flow_internals flow; struct softnic_conn *conn; struct softnic_mempool_list mempool_list; struct softnic_swq_list swq_list; @@ -510,6 +526,21 @@ struct pmd_internals { struct softnic_thread_data thread_data[RTE_MAX_LCORE]; }; +/** + * Ethdev Flow API + */ +int +flow_attr_map_set(struct pmd_internals *softnic, + uint32_t group_id, + int ingress, + const char *pipeline_name, + uint32_t table_id); + +struct flow_attr_map * +flow_attr_map_get(struct pmd_internals *softnic, + uint32_t group_id, + int ingress); + /** * MEMPOOL */