Soft Patch Panel
 help / color / mirror / Atom feed
From: x-fn-spp-ml@ntt-tx.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH v2 10/17] spp_primary: add actions of rte_flow
Date: Wed, 19 Feb 2020 20:49:40 +0900
Message-ID: <20200219114947.14134-11-x-fn-spp-ml@ntt-tx.co.jp> (raw)
In-Reply-To: <20200218063720.6597-1-x-fn-spp-ml@ntt-tx.co.jp>

From: Hideyuki Yamashita <yamashita.hideyuki@ntt-tx.co.jp>

To support rte_flow in SPP, this patch adds the following
actions of rte_flow.
   - queue
   - jump
   - pop_vlan
   - push_vlan
   - set_vlan_vid
   - set_vlan_pcp
Additional files should be added when new actions should be
newly supported by SPP.

Signed-off-by: Hideyuki Yamashita <yamashita.hideyuki@ntt-tx.co.jp>
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 src/primary/flow/action/jump.c            | 42 ++++++++++++++++++++++
 src/primary/flow/action/jump.h            | 12 +++++++
 src/primary/flow/action/of_push_vlan.c    | 44 +++++++++++++++++++++++
 src/primary/flow/action/of_push_vlan.h    | 13 +++++++
 src/primary/flow/action/of_set_vlan_pcp.c | 44 +++++++++++++++++++++++
 src/primary/flow/action/of_set_vlan_pcp.h | 13 +++++++
 src/primary/flow/action/of_set_vlan_vid.c | 44 +++++++++++++++++++++++
 src/primary/flow/action/of_set_vlan_vid.h | 13 +++++++
 src/primary/flow/action/queue.c           | 42 ++++++++++++++++++++++
 src/primary/flow/action/queue.h           | 13 +++++++
 10 files changed, 280 insertions(+)
 create mode 100644 src/primary/flow/action/jump.c
 create mode 100644 src/primary/flow/action/jump.h
 create mode 100644 src/primary/flow/action/of_push_vlan.c
 create mode 100644 src/primary/flow/action/of_push_vlan.h
 create mode 100644 src/primary/flow/action/of_set_vlan_pcp.c
 create mode 100644 src/primary/flow/action/of_set_vlan_pcp.h
 create mode 100644 src/primary/flow/action/of_set_vlan_vid.c
 create mode 100644 src/primary/flow/action/of_set_vlan_vid.h
 create mode 100644 src/primary/flow/action/queue.c
 create mode 100644 src/primary/flow/action/queue.h

diff --git a/src/primary/flow/action/jump.c b/src/primary/flow/action/jump.c
new file mode 100644
index 0000000..b643015
--- /dev/null
+++ b/src/primary/flow/action/jump.c
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
+ */
+
+#include <rte_flow.h>
+
+#include "primary/flow/flow.h"
+#include "primary/flow/common.h"
+#include "jump.h"
+
+/* Define action "jump" operations */
+struct flow_detail_ops jump_ops_list[] = {
+	{
+		.token = "group",
+		.offset = offsetof(struct rte_flow_action_jump, group),
+		.size = sizeof(uint32_t),
+		.flg_value = 1,
+		.parse_detail = str_to_uint32_t,
+	},
+	{
+		.token = NULL,
+	},
+};
+
+int
+append_action_jump_json(const void *conf, int buf_size, char *action_str)
+{
+	const struct rte_flow_action_jump *jump = conf;
+	char tmp_str[64] = { 0 };
+
+	snprintf(tmp_str, 64,
+		"{\"group\":%d}",
+		jump->group);
+
+	if ((int)strlen(action_str) + (int)strlen(tmp_str)
+		> buf_size)
+		return -1;
+
+	strncat(action_str, tmp_str, strlen(tmp_str));
+
+	return 0;
+}
diff --git a/src/primary/flow/action/jump.h b/src/primary/flow/action/jump.h
new file mode 100644
index 0000000..f8c6a60
--- /dev/null
+++ b/src/primary/flow/action/jump.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
+ */
+
+#ifndef _PRIMARY_FLOW_ACTION_JUMP_H_
+#define _PRIMARY_FLOW_ACTION_JUMP_H_
+
+extern struct flow_detail_ops jump_ops_list[];
+
+int append_action_jump_json(const void *conf, int buf_size, char *action_str);
+
+#endif
diff --git a/src/primary/flow/action/of_push_vlan.c b/src/primary/flow/action/of_push_vlan.c
new file mode 100644
index 0000000..749490e
--- /dev/null
+++ b/src/primary/flow/action/of_push_vlan.c
@@ -0,0 +1,44 @@
+/* SPDX-License-Identifier: BSD-3-Claus1
+ * Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
+ */
+
+#include <rte_flow.h>
+
+#include "primary/flow/flow.h"
+#include "primary/flow/common.h"
+#include "of_push_vlan.h"
+
+/* Define action "of_push_vlan" operations */
+struct flow_detail_ops of_push_vlan_ops_list[] = {
+	{
+		.token = "ethertype",
+		.offset = offsetof(struct rte_flow_action_of_push_vlan,
+			ethertype),
+		.size = sizeof(rte_be16_t),
+		.flg_value = 1,
+		.parse_detail = str_to_rte_be16_t,
+	},
+	{
+		.token = NULL,
+	},
+};
+
+int
+append_action_of_push_vlan_json(const void *conf, int buf_size,
+	char *action_str)
+{
+	const struct rte_flow_action_of_push_vlan *of_push_vlan = conf;
+	char tmp_str[64] = { 0 };
+
+	snprintf(tmp_str, 64,
+		"{\"ethertype\":\"0x%04x\"}",
+		of_push_vlan->ethertype);
+
+	if ((int)strlen(action_str) + (int)strlen(tmp_str)
+		> buf_size)
+		return -1;
+
+	strncat(action_str, tmp_str, strlen(tmp_str));
+
+	return 0;
+}
diff --git a/src/primary/flow/action/of_push_vlan.h b/src/primary/flow/action/of_push_vlan.h
new file mode 100644
index 0000000..7c37ab1
--- /dev/null
+++ b/src/primary/flow/action/of_push_vlan.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
+ */
+
+#ifndef _PRIMARY_FLOW_ACTION_OF_PUSH_VLAN_H_
+#define _PRIMARY_FLOW_ACTION_OF_PUSH_VLAN_H_
+
+extern struct flow_detail_ops of_push_vlan_ops_list[];
+
+int append_action_of_push_vlan_json(const void *conf, int buf_size,
+	char *action_str);
+
+#endif
diff --git a/src/primary/flow/action/of_set_vlan_pcp.c b/src/primary/flow/action/of_set_vlan_pcp.c
new file mode 100644
index 0000000..33e23d5
--- /dev/null
+++ b/src/primary/flow/action/of_set_vlan_pcp.c
@@ -0,0 +1,44 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
+ */
+
+#include <rte_flow.h>
+
+#include "primary/flow/flow.h"
+#include "primary/flow/common.h"
+#include "of_set_vlan_pcp.h"
+
+/* Define action "of_set_vlan_pcp" operations */
+struct flow_detail_ops of_set_vlan_pcp_ops_list[] = {
+	{
+		.token = "vlan_pcp",
+		.offset = offsetof(struct rte_flow_action_of_set_vlan_pcp,
+			vlan_pcp),
+		.size = sizeof(uint8_t),
+		.flg_value = 1,
+		.parse_detail = str_to_pcp,
+	},
+	{
+		.token = NULL,
+	},
+};
+
+int
+append_action_of_set_vlan_pcp_json(const void *conf, int buf_size,
+	char *action_str)
+{
+	const struct rte_flow_action_of_set_vlan_pcp *pcp = conf;
+	char tmp_str[64] = { 0 };
+
+	snprintf(tmp_str, 64,
+		"{\"vlan_pcp\":\"0x%01x\"}",
+		pcp->vlan_pcp);
+
+	if ((int)strlen(action_str) + (int)strlen(tmp_str)
+		> buf_size)
+		return -1;
+
+	strncat(action_str, tmp_str, strlen(tmp_str));
+
+	return 0;
+}
diff --git a/src/primary/flow/action/of_set_vlan_pcp.h b/src/primary/flow/action/of_set_vlan_pcp.h
new file mode 100644
index 0000000..3f8a4b3
--- /dev/null
+++ b/src/primary/flow/action/of_set_vlan_pcp.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
+ */
+
+#ifndef _PRIMARY_FLOW_ACTION_OF_SET_VLAN_PCP_H_
+#define _PRIMARY_FLOW_ACTION_OF_SET_VLAN_PCP_H_
+
+extern struct flow_detail_ops of_set_vlan_pcp_ops_list[];
+
+int append_action_of_set_vlan_pcp_json(const void *conf, int buf_size,
+	char *action_str);
+
+#endif
diff --git a/src/primary/flow/action/of_set_vlan_vid.c b/src/primary/flow/action/of_set_vlan_vid.c
new file mode 100644
index 0000000..930cef5
--- /dev/null
+++ b/src/primary/flow/action/of_set_vlan_vid.c
@@ -0,0 +1,44 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
+ */
+
+#include <rte_flow.h>
+
+#include "primary/flow/flow.h"
+#include "primary/flow/common.h"
+#include "of_set_vlan_vid.h"
+
+/* Define action "of_set_vlan_vid" operations */
+struct flow_detail_ops of_set_vlan_vid_ops_list[] = {
+	{
+		.token = "vlan_vid",
+		.offset = offsetof(struct rte_flow_action_of_set_vlan_vid,
+			vlan_vid),
+		.size = sizeof(rte_be16_t),
+		.flg_value = 1,
+		.parse_detail = str_to_rte_be16_t,
+	},
+	{
+		.token = NULL,
+	},
+};
+
+int
+append_action_of_set_vlan_vid_json(const void *conf, int buf_size,
+	char *action_str)
+{
+	const struct rte_flow_action_of_set_vlan_vid *vid = conf;
+	char tmp_str[64] = { 0 };
+
+	snprintf(tmp_str, 64,
+		"{\"vlan_vid\":\"0x%04x\"}",
+		vid->vlan_vid);
+
+	if ((int)strlen(action_str) + (int)strlen(tmp_str)
+		> buf_size)
+		return -1;
+
+	strncat(action_str, tmp_str, strlen(tmp_str));
+
+	return 0;
+}
diff --git a/src/primary/flow/action/of_set_vlan_vid.h b/src/primary/flow/action/of_set_vlan_vid.h
new file mode 100644
index 0000000..a0abe85
--- /dev/null
+++ b/src/primary/flow/action/of_set_vlan_vid.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
+ */
+
+#ifndef _PRIMARY_FLOW_ACTION_OF_SET_VLAN_VID_H_
+#define _PRIMARY_FLOW_ACTION_OF_SET_VLAN_VID_H_
+
+extern struct flow_detail_ops of_set_vlan_vid_ops_list[];
+
+int append_action_of_set_vlan_vid_json(const void *conf, int buf_size,
+	char *action_str);
+
+#endif
diff --git a/src/primary/flow/action/queue.c b/src/primary/flow/action/queue.c
new file mode 100644
index 0000000..f7bcdce
--- /dev/null
+++ b/src/primary/flow/action/queue.c
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
+ */
+
+#include <rte_flow.h>
+
+#include "primary/flow/flow.h"
+#include "primary/flow/common.h"
+#include "queue.h"
+
+/* Define action "queue" operations */
+struct flow_detail_ops queue_ops_list[] = {
+	{
+		.token = "index",
+		.offset = offsetof(struct rte_flow_action_queue, index),
+		.size = sizeof(uint16_t),
+		.flg_value = 1,
+		.parse_detail = str_to_uint16_t,
+	},
+	{
+		.token = NULL,
+	},
+};
+
+int
+append_action_queue_json(const void *conf, int buf_size, char *action_str)
+{
+	const struct rte_flow_action_queue *queue = conf;
+	char tmp_str[64] = { 0 };
+
+	snprintf(tmp_str, 64,
+		"{\"index\":%d}",
+		queue->index);
+
+	if ((int)strlen(action_str) + (int)strlen(tmp_str)
+		> buf_size)
+		return -1;
+
+	strncat(action_str, tmp_str, strlen(tmp_str));
+
+	return 0;
+}
diff --git a/src/primary/flow/action/queue.h b/src/primary/flow/action/queue.h
new file mode 100644
index 0000000..22816c7
--- /dev/null
+++ b/src/primary/flow/action/queue.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
+ */
+
+#ifndef _PRIMARY_FLOW_ACTION_QUEUE_H_
+#define _PRIMARY_FLOW_ACTION_QUEUE_H_
+
+extern struct flow_detail_ops queue_ops_list[];
+
+int append_action_queue_json(const void *conf, int buf_size,
+	char *action_str);
+
+#endif
-- 
2.17.1


  parent reply	other threads:[~2020-02-19 11:50 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18  6:37 [spp] [PATCH 00/17] Adding Hardware offload capability x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 01/17] shared: add support of multi-queue x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 02/17] spp_vf: " x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 03/17] spp_mirror: " x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 04/17] spp_pcap: " x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 05/17] spp_primary: " x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 06/17] spp_primary: add support of rte_flow x-fn-spp-ml
2020-02-19  2:24   ` Yasufumi Ogawa
2020-02-19 11:57     ` [spp] (x-fn-spp-ml 118) " Hideyuki Yamashita
2020-02-18  6:37 ` [spp] [PATCH 07/17] spp_primary: add common function " x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 08/17] spp_primary: add attribute " x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 09/17] spp_primary: add patterns " x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 10/17] spp_primary: add actions " x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 11/17] bin: add parameter for hardrare offload x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 12/17] cli: add support of hardware offload x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 13/17] cli: add support of rte_flow in vf x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 14/17] cli: add support of rte_flow in mirror x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 15/17] cli: add support of rte_flow in nfv x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 16/17] spp-ctl: add APIs for flow rules x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 17/17] spp_nfv: add support of multi-queue x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 00/17] Adding Hardware offload capability x-fn-spp-ml
2020-02-21  8:17   ` Yasufumi Ogawa
2020-02-25  5:49     ` [spp] (x-fn-spp-ml 177) " Hideyuki Yamashita
2020-02-19 11:49 ` [spp] [PATCH v2 01/17] shared: add support of multi-queue x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 02/17] spp_vf: " x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 03/17] spp_mirror: " x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 04/17] spp_pcap: " x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 05/17] spp_primary: " x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 06/17] spp_primary: add support of rte_flow x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 07/17] spp_primary: add common function " x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 08/17] spp_primary: add attribute " x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 09/17] spp_primary: add patterns " x-fn-spp-ml
2020-02-19 11:49 ` x-fn-spp-ml [this message]
2020-02-19 11:49 ` [spp] [PATCH v2 11/17] bin: add parameter for hardrare offload x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 12/17] cli: add support of hardware offload x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 13/17] cli: add support of rte_flow in vf x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 14/17] cli: add support of rte_flow in mirror x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 15/17] cli: add support of rte_flow in nfv x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 16/17] spp-ctl: add APIs for flow rules x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 17/17] spp_nfv: add support of multi-queue x-fn-spp-ml

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200219114947.14134-11-x-fn-spp-ml@ntt-tx.co.jp \
    --to=x-fn-spp-ml@ntt-tx.co.jp \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    --cc=yasufum.o@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Soft Patch Panel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/spp/0 spp/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 spp spp/ https://inbox.dpdk.org/spp \
		spp@dpdk.org
	public-inbox-index spp

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.spp


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git