All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Sheehan,Georgina" <georgina.sheehan@intel.com>
To: dev@dpdk.org
Cc: cristian.dumitrescu@intel.com,
	Georgina Sheehan <georgina.sheehan@intel.com>
Subject: [PATCH v1 3/3] net/softnic: add support for DSCP action
Date: Sun, 11 Feb 2018 08:57:22 +0000	[thread overview]
Message-ID: <20180211085722.59717-3-georgina.sheehan@intel.com> (raw)
In-Reply-To: <20180211085722.59717-1-georgina.sheehan@intel.com>

From: Georgina Sheehan <georgina.sheehan@intel.com>

This allows the application to change the DSCP value of incoming packets

Signed-off-by: Georgina Sheehan <georgina.sheehan@intel.com>
---
 drivers/net/softnic/rte_eth_softnic_action.c  | 14 ++++++++
 drivers/net/softnic/rte_eth_softnic_cli.c     | 34 +++++++++++++++++++
 .../net/softnic/rte_eth_softnic_internals.h   |  2 ++
 drivers/net/softnic/rte_eth_softnic_thread.c  | 10 ++++++
 4 files changed, 60 insertions(+)

diff --git a/drivers/net/softnic/rte_eth_softnic_action.c b/drivers/net/softnic/rte_eth_softnic_action.c
index 92c744dc9..98d03d5ef 100644
--- a/drivers/net/softnic/rte_eth_softnic_action.c
+++ b/drivers/net/softnic/rte_eth_softnic_action.c
@@ -397,12 +397,26 @@ softnic_table_action_profile_create(struct pmd_internals *p,
 		}
 	}
 
+	if (params->action_mask & (1LLU << RTE_TABLE_ACTION_DSCP)) {
+		status = rte_table_action_profile_action_register(ap,
+			RTE_TABLE_ACTION_DSCP,
+			&params->dscp);
+
+		if (status) {
+			rte_table_action_profile_free(ap);
+			return NULL;
+		}
+	}
+
+
 	status = rte_table_action_profile_freeze(ap);
 	if (status) {
 		rte_table_action_profile_free(ap);
 		return NULL;
 	}
 
+
+
 	/* Node allocation */
 	profile = calloc(1, sizeof(struct softnic_table_action_profile));
 	if (profile == NULL) {
diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c
index 76136c2e2..d576cdbfb 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -1358,6 +1358,7 @@ cmd_port_in_action_profile(struct pmd_internals *softnic,
  *  [time]
  *  [tag]
  *  [decap]
+ *  [dscp]
  *
  */
 static void
@@ -1787,6 +1788,17 @@ cmd_table_action_profile(struct pmd_internals *softnic,
 		t0 += 5;
 	} /* sym_crypto */
 
+	if (t0 < n_tokens && (strcmp(tokens[t0], "dscp") == 0)) {
+		if (n_tokens < t0 + 1) {
+			snprintf(out, out_size, MSG_ARG_MISMATCH,
+				"table action profile dscp");
+			return;
+		}
+
+		p.action_mask |= 1LLU << RTE_TABLE_ACTION_DSCP;
+		t0 += 1;
+	} /** DSCP **/
+
 	if (t0 < n_tokens) {
 		snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
 		return;
@@ -3432,6 +3444,7 @@ parse_match(char **tokens,
  *          aead_algo <algo> aead_key <key> aead_iv <iv> aead_aad <aad>
  *          digest_size <size>
  *       data_offset <data_offset>]
+ *    [dscp <n>]
  *
  * where:
  *    <pa> ::= g | y | r | drop
@@ -4431,6 +4444,27 @@ parse_table_action_decap(char **tokens,
 	return 2;
 }
 
+static uint32_t
+parse_table_action_dscp(char **tokens,
+		uint32_t n_tokens,
+		struct softnic_table_rule_action *a)
+{
+	if (n_tokens < 2 ||
+		strcmp(tokens[0], "dscp"))
+		return 0;
+
+	uint8_t dscp_val;
+
+	if (softnic_parser_read_uint8(&dscp_val, tokens[1]))
+		return 0;
+
+	a->dscp.dscp_val = dscp_val;
+
+	a->action_mask |= 1 << RTE_TABLE_ACTION_DSCP;
+
+	return 2;
+}
+
 static uint32_t
 parse_table_action(char **tokens,
 	uint32_t n_tokens,
diff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h
index 415434d0d..67ba3ecf3 100644
--- a/drivers/net/softnic/rte_eth_softnic_internals.h
+++ b/drivers/net/softnic/rte_eth_softnic_internals.h
@@ -333,6 +333,7 @@ struct softnic_table_action_profile_params {
 	struct rte_table_action_ttl_config ttl;
 	struct rte_table_action_stats_config stats;
 	struct rte_table_action_sym_crypto_config sym_crypto;
+	struct rte_table_action_dscp_config dscp;
 };
 
 struct softnic_table_action_profile {
@@ -962,6 +963,7 @@ struct softnic_table_rule_action {
 	struct rte_table_action_tag_params tag;
 	struct rte_table_action_decap_params decap;
 	struct rte_table_action_sym_crypto_params sym_crypto;
+	struct rte_table_action_dscp_params dscp;
 };
 
 struct rte_flow {
diff --git a/drivers/net/softnic/rte_eth_softnic_thread.c b/drivers/net/softnic/rte_eth_softnic_thread.c
index 57989a5aa..e73d4a704 100644
--- a/drivers/net/softnic/rte_eth_softnic_thread.c
+++ b/drivers/net/softnic/rte_eth_softnic_thread.c
@@ -2598,6 +2598,16 @@ action_convert(struct rte_table_action *a,
 			return status;
 	}
 
+	if (action->action_mask & (1LLU << RTE_TABLE_ACTION_DSCP)) {
+		status = rte_table_action_apply(a,
+			data,
+			RTE_TABLE_ACTION_DSCP,
+			&action->dscp);
+
+		if (status)
+			return status;
+	}
+
 	return 0;
 }
 
-- 
2.17.1

  parent reply	other threads:[~2019-02-12  9:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-11  8:57 [PATCH v1 1/3] librte_pipeline: add support for DSCP action Sheehan,Georgina
2018-02-11  8:57 ` [PATCH v1 2/3] pipeline: add implementation " Sheehan,Georgina
2018-02-11  8:57 ` Sheehan,Georgina [this message]
2018-02-11 13:29 ` [PATCH v2 1/3] librte_pipeline: add support " Sheehan,Georgina
2018-02-11 13:29   ` [PATCH v2 2/3] pipeline: add implementation " Sheehan,Georgina
2019-02-28 19:24     ` Dumitrescu, Cristian
2018-02-11 13:29   ` [PATCH v2 3/3] net/softnic: add support " Sheehan,Georgina
2019-02-28 19:21   ` [PATCH v2 1/3] librte_pipeline: " Dumitrescu, Cristian

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=20180211085722.59717-3-georgina.sheehan@intel.com \
    --to=georgina.sheehan@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.