From patchwork Thu Oct 11 11:41:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 46607 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 96E661B568; Thu, 11 Oct 2018 13:41:54 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 530D71B53E for ; Thu, 11 Oct 2018 13:41:47 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2018 04:41:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,368,1534834800"; d="scan'208";a="94289030" Received: from silpixa00382658.ir.intel.com ([10.237.223.29]) by fmsmga002.fm.intel.com with ESMTP; 11 Oct 2018 04:41:35 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Date: Thu, 11 Oct 2018 12:41:11 +0100 Message-Id: <1539258078-85906-1-git-send-email-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH v4 1/8] pipeline: add table action for packet tag 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" This patch introduces the packet tag table action which attaches a 32-bit value (the tag) to the current input packet. The tag is read from the current table entry. The tag is written into the mbuf->hash.fdir.hi and the flags PKT_RX_FDIR and PKT_RX_FDIR_ID are set into mbuf->ol_flags. Signed-off-by: Cristian Dumitrescu --- lib/librte_pipeline/rte_table_action.c | 78 ++++++++++++++++++++++++++++++++++ lib/librte_pipeline/rte_table_action.h | 12 ++++++ 2 files changed, 90 insertions(+) diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index edb3340..fb7eaf9 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -2012,6 +2012,50 @@ pkt_work_sym_crypto(struct rte_mbuf *mbuf, struct sym_crypto_data *data, } /** + * RTE_TABLE_ACTION_TAG + */ +struct tag_data { + uint32_t tag; +} __attribute__((__packed__)); + +static int +tag_apply(struct tag_data *data, + struct rte_table_action_tag_params *p) +{ + data->tag = p->tag; + return 0; +} + +static __rte_always_inline void +pkt_work_tag(struct rte_mbuf *mbuf, + struct tag_data *data) +{ + mbuf->hash.fdir.hi = data->tag; + mbuf->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID; +} + +static __rte_always_inline void +pkt4_work_tag(struct rte_mbuf *mbuf0, + struct rte_mbuf *mbuf1, + struct rte_mbuf *mbuf2, + struct rte_mbuf *mbuf3, + struct tag_data *data0, + struct tag_data *data1, + struct tag_data *data2, + struct tag_data *data3) +{ + mbuf0->hash.fdir.hi = data0->tag; + mbuf1->hash.fdir.hi = data1->tag; + mbuf2->hash.fdir.hi = data2->tag; + mbuf3->hash.fdir.hi = data3->tag; + + mbuf0->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID; + mbuf1->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID; + mbuf2->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID; + mbuf3->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID; +} + +/** * Action profile */ static int @@ -2028,6 +2072,7 @@ action_valid(enum rte_table_action_type action) case RTE_TABLE_ACTION_STATS: case RTE_TABLE_ACTION_TIME: case RTE_TABLE_ACTION_SYM_CRYPTO: + case RTE_TABLE_ACTION_TAG: return 1; default: return 0; @@ -2162,6 +2207,9 @@ action_data_size(enum rte_table_action_type action, case RTE_TABLE_ACTION_SYM_CRYPTO: return (sizeof(struct sym_crypto_data)); + case RTE_TABLE_ACTION_TAG: + return sizeof(struct tag_data); + default: return 0; } @@ -2419,6 +2467,10 @@ rte_table_action_apply(struct rte_table_action *action, &action->cfg.sym_crypto, action_params); + case RTE_TABLE_ACTION_TAG: + return tag_apply(action_data, + action_params); + default: return -EINVAL; } @@ -2803,6 +2855,14 @@ pkt_work(struct rte_mbuf *mbuf, ip_offset); } + if (cfg->action_mask & (1LLU << RTE_TABLE_ACTION_TAG)) { + void *data = action_data_get(table_entry, + action, + RTE_TABLE_ACTION_TAG); + + pkt_work_tag(mbuf, data); + } + return drop_mask; } @@ -3111,6 +3171,24 @@ pkt4_work(struct rte_mbuf **mbufs, ip_offset); } + if (cfg->action_mask & (1LLU << RTE_TABLE_ACTION_TAG)) { + void *data0 = action_data_get(table_entry0, + action, + RTE_TABLE_ACTION_TAG); + void *data1 = action_data_get(table_entry1, + action, + RTE_TABLE_ACTION_TAG); + void *data2 = action_data_get(table_entry2, + action, + RTE_TABLE_ACTION_TAG); + void *data3 = action_data_get(table_entry3, + action, + RTE_TABLE_ACTION_TAG); + + pkt4_work_tag(mbuf0, mbuf1, mbuf2, mbuf3, + data0, data1, data2, data3); + } + return drop_mask0 | (drop_mask1 << 1) | (drop_mask2 << 2) | diff --git a/lib/librte_pipeline/rte_table_action.h b/lib/librte_pipeline/rte_table_action.h index e8a7b66..5dbb147 100644 --- a/lib/librte_pipeline/rte_table_action.h +++ b/lib/librte_pipeline/rte_table_action.h @@ -96,6 +96,9 @@ enum rte_table_action_type { /** Crypto. */ RTE_TABLE_ACTION_SYM_CRYPTO, + + /** Tag. */ + RTE_TABLE_ACTION_TAG, }; /** Common action configuration (per table action profile). */ @@ -771,6 +774,15 @@ struct rte_table_action_sym_crypto_params { }; /** + * RTE_TABLE_ACTION_TAG + */ +/** Tag action parameters (per table rule). */ +struct rte_table_action_tag_params { + /** Tag to be attached to the input packet. */ + uint32_t tag; +}; + +/** * Table action profile. */ struct rte_table_action_profile; From patchwork Thu Oct 11 11:41:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 46604 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 98D6F1B544; Thu, 11 Oct 2018 13:41:48 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 4291E1B515 for ; Thu, 11 Oct 2018 13:41:46 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2018 04:41:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,368,1534834800"; d="scan'208";a="94289032" Received: from silpixa00382658.ir.intel.com ([10.237.223.29]) by fmsmga002.fm.intel.com with ESMTP; 11 Oct 2018 04:41:36 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Date: Thu, 11 Oct 2018 12:41:12 +0100 Message-Id: <1539258078-85906-2-git-send-email-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539258078-85906-1-git-send-email-cristian.dumitrescu@intel.com> References: <1539258078-85906-1-git-send-email-cristian.dumitrescu@intel.com> Subject: [dpdk-dev] [PATCH v4 2/8] examples/ip_pipeline: add support for packet tag table action 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" Add support for the packet tag table action. Signed-off-by: Cristian Dumitrescu --- examples/ip_pipeline/action.c | 11 +++++++++++ examples/ip_pipeline/cli.c | 38 +++++++++++++++++++++++++++++++++++++- examples/ip_pipeline/pipeline.h | 1 + examples/ip_pipeline/thread.c | 10 ++++++++++ 4 files changed, 59 insertions(+), 1 deletion(-) diff --git a/examples/ip_pipeline/action.c b/examples/ip_pipeline/action.c index a0f97be..3f825a0 100644 --- a/examples/ip_pipeline/action.c +++ b/examples/ip_pipeline/action.c @@ -344,6 +344,17 @@ table_action_profile_create(const char *name, } } + if (params->action_mask & (1LLU << RTE_TABLE_ACTION_TAG)) { + status = rte_table_action_profile_action_register(ap, + RTE_TABLE_ACTION_TAG, + NULL); + + 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); diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index 3ff7caa..a85d04c 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -1032,7 +1032,8 @@ static const char cmd_table_action_profile_help[] = " [time]\n" " [sym_crypto dev offset " " mempool_create \n" -" mempool_init ]\n"; +" mempool_init ]\n" +" [tag]\n"; static void cmd_table_action_profile(char **tokens, @@ -1451,6 +1452,11 @@ cmd_table_action_profile(char **tokens, t0 += 9; } /* sym_crypto */ + if ((t0 < n_tokens) && (strcmp(tokens[t0], "tag") == 0)) { + p.action_mask |= 1LLU << RTE_TABLE_ACTION_TAG; + t0 += 1; + } /* tag */ + if (t0 < n_tokens) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); return; @@ -3107,6 +3113,7 @@ parse_match(char **tokens, * aead_algo aead_key aead_iv aead_aad * digest_size * data_offset ] + * [tag ] * * where: * ::= g | y | r | drop @@ -4068,6 +4075,22 @@ parse_table_action_sym_crypto(char **tokens, } static uint32_t +parse_table_action_tag(char **tokens, + uint32_t n_tokens, + struct table_rule_action *a) +{ + if ((n_tokens < 2) || + strcmp(tokens[0], "tag")) + return 0; + + if (parser_read_uint32(&a->tag.tag, tokens[1])) + return 0; + + a->action_mask |= 1 << RTE_TABLE_ACTION_TAG; + return 2; +} + +static uint32_t parse_table_action(char **tokens, uint32_t n_tokens, char *out, @@ -4218,6 +4241,19 @@ parse_table_action(char **tokens, if (n == 0) { snprintf(out, out_size, MSG_ARG_INVALID, "action sym_crypto"); + } + + tokens += n; + n_tokens -= n; + } + + if (n_tokens && (strcmp(tokens[0], "tag") == 0)) { + uint32_t n; + + n = parse_table_action_tag(tokens, n_tokens, a); + if (n == 0) { + snprintf(out, out_size, MSG_ARG_INVALID, + "action tag"); return 0; } diff --git a/examples/ip_pipeline/pipeline.h b/examples/ip_pipeline/pipeline.h index b6b9dc0..73485f6 100644 --- a/examples/ip_pipeline/pipeline.h +++ b/examples/ip_pipeline/pipeline.h @@ -282,6 +282,7 @@ struct table_rule_action { struct rte_table_action_stats_params stats; struct rte_table_action_time_params time; struct rte_table_action_sym_crypto_params sym_crypto; + struct rte_table_action_tag_params tag; }; int diff --git a/examples/ip_pipeline/thread.c b/examples/ip_pipeline/thread.c index 3ec44c9..41891f4 100644 --- a/examples/ip_pipeline/thread.c +++ b/examples/ip_pipeline/thread.c @@ -2494,6 +2494,16 @@ action_convert(struct rte_table_action *a, return status; } + if (action->action_mask & (1LLU << RTE_TABLE_ACTION_TAG)) { + status = rte_table_action_apply(a, + data, + RTE_TABLE_ACTION_TAG, + &action->tag); + + if (status) + return status; + } + return 0; } From patchwork Thu Oct 11 11:41:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 46610 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 2CF671B585; Thu, 11 Oct 2018 13:42:00 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id EC3F81B544 for ; Thu, 11 Oct 2018 13:41:47 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2018 04:41:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,368,1534834800"; d="scan'208";a="94289058" Received: from silpixa00382658.ir.intel.com ([10.237.223.29]) by fmsmga002.fm.intel.com with ESMTP; 11 Oct 2018 04:41:36 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Date: Thu, 11 Oct 2018 12:41:13 +0100 Message-Id: <1539258078-85906-3-git-send-email-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539258078-85906-1-git-send-email-cristian.dumitrescu@intel.com> References: <1539258078-85906-1-git-send-email-cristian.dumitrescu@intel.com> Subject: [dpdk-dev] [PATCH v4 3/8] net/softnic: add support for packet tag table action 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" Add support for packet tag table action. Signed-off-by: Cristian Dumitrescu --- drivers/net/softnic/rte_eth_softnic_action.c | 11 +++++++ drivers/net/softnic/rte_eth_softnic_cli.c | 38 +++++++++++++++++++++++++ drivers/net/softnic/rte_eth_softnic_internals.h | 1 + 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 c542688..133dd06 100644 --- a/drivers/net/softnic/rte_eth_softnic_action.c +++ b/drivers/net/softnic/rte_eth_softnic_action.c @@ -364,6 +364,17 @@ softnic_table_action_profile_create(struct pmd_internals *p, } } + if (params->action_mask & (1LLU << RTE_TABLE_ACTION_TAG)) { + status = rte_table_action_profile_action_register(ap, + RTE_TABLE_ACTION_TAG, + NULL); + + 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); diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c index dc8ccdc..31c37da 100644 --- a/drivers/net/softnic/rte_eth_softnic_cli.c +++ b/drivers/net/softnic/rte_eth_softnic_cli.c @@ -1279,6 +1279,7 @@ cmd_port_in_action_profile(struct pmd_internals *softnic, * stats none | pkts] * [stats pkts | bytes | both] * [time] + * [tag] */ static void cmd_table_action_profile(struct pmd_internals *softnic, @@ -1610,6 +1611,12 @@ cmd_table_action_profile(struct pmd_internals *softnic, t0 += 1; } /* time */ + if (t0 < n_tokens && + (strcmp(tokens[t0], "tag") == 0)) { + p.action_mask |= 1LLU << RTE_TABLE_ACTION_TAG; + t0 += 1; + } /* tag */ + if (t0 < n_tokens) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); return; @@ -3176,6 +3183,7 @@ parse_match(char **tokens, * [ttl dec | keep] * [stats] * [time] + * [tag ] * * where: * ::= g | y | r | drop @@ -3666,6 +3674,22 @@ parse_table_action_time(char **tokens, } static uint32_t +parse_table_action_tag(char **tokens, + uint32_t n_tokens, + struct softnic_table_rule_action *a) +{ + if (n_tokens < 2 || + strcmp(tokens[0], "tag")) + return 0; + + if (softnic_parser_read_uint32(&a->tag.tag, tokens[1])) + return 0; + + a->action_mask |= 1 << RTE_TABLE_ACTION_TAG; + return 2; +} + +static uint32_t parse_table_action(char **tokens, uint32_t n_tokens, char *out, @@ -3809,6 +3833,20 @@ parse_table_action(char **tokens, n_tokens -= n; } + if (n_tokens && (strcmp(tokens[0], "tag") == 0)) { + uint32_t n; + + n = parse_table_action_tag(tokens, n_tokens, a); + if (n == 0) { + snprintf(out, out_size, MSG_ARG_INVALID, + "action tag"); + return 0; + } + + tokens += n; + n_tokens -= n; + } + if (n_tokens0 - n_tokens == 1) { snprintf(out, out_size, MSG_ARG_INVALID, "action"); return 0; diff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h index 78864e7..1623ff8 100644 --- a/drivers/net/softnic/rte_eth_softnic_internals.h +++ b/drivers/net/softnic/rte_eth_softnic_internals.h @@ -897,6 +897,7 @@ struct softnic_table_rule_action { struct rte_table_action_ttl_params ttl; struct rte_table_action_stats_params stats; struct rte_table_action_time_params time; + struct rte_table_action_tag_params tag; }; struct rte_flow { diff --git a/drivers/net/softnic/rte_eth_softnic_thread.c b/drivers/net/softnic/rte_eth_softnic_thread.c index 87b5592..e1d002e 100644 --- a/drivers/net/softnic/rte_eth_softnic_thread.c +++ b/drivers/net/softnic/rte_eth_softnic_thread.c @@ -2478,6 +2478,16 @@ action_convert(struct rte_table_action *a, return status; } + if (action->action_mask & (1LLU << RTE_TABLE_ACTION_TAG)) { + status = rte_table_action_apply(a, + data, + RTE_TABLE_ACTION_TAG, + &action->tag); + + if (status) + return status; + } + return 0; } From patchwork Thu Oct 11 11:41:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 46608 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 44E811B574; Thu, 11 Oct 2018 13:41:56 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id C29831B515 for ; Thu, 11 Oct 2018 13:41:47 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2018 04:41:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,368,1534834800"; d="scan'208";a="94289068" Received: from silpixa00382658.ir.intel.com ([10.237.223.29]) by fmsmga002.fm.intel.com with ESMTP; 11 Oct 2018 04:41:37 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Date: Thu, 11 Oct 2018 12:41:14 +0100 Message-Id: <1539258078-85906-4-git-send-email-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539258078-85906-1-git-send-email-cristian.dumitrescu@intel.com> References: <1539258078-85906-1-git-send-email-cristian.dumitrescu@intel.com> Subject: [dpdk-dev] [PATCH v4 4/8] net/softnic: add support for flow api mark action 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" Add support for ethdev flow API mark action. Signed-off-by: Cristian Dumitrescu --- drivers/net/softnic/rte_eth_softnic_flow.c | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/net/softnic/rte_eth_softnic_flow.c b/drivers/net/softnic/rte_eth_softnic_flow.c index 30aa6af..9bb0d56 100644 --- a/drivers/net/softnic/rte_eth_softnic_flow.c +++ b/drivers/net/softnic/rte_eth_softnic_flow.c @@ -1168,6 +1168,7 @@ flow_rule_action_get(struct pmd_internals *softnic, struct softnic_table_action_profile_params *params; int n_jump_queue_rss_drop = 0; int n_count = 0; + int n_mark = 0; profile = softnic_table_action_profile_find(softnic, table->params.action_profile_name); @@ -1475,6 +1476,40 @@ flow_rule_action_get(struct pmd_internals *softnic, break; } /* RTE_FLOW_ACTION_TYPE_COUNT */ + case RTE_FLOW_ACTION_TYPE_MARK: + { + const struct rte_flow_action_mark *conf = action->conf; + + if (conf == NULL) + return rte_flow_error_set(error, + EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + action, + "MARK: Null configuration"); + + if (n_mark) + return rte_flow_error_set(error, + ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, + action, + "Only one MARK action per flow"); + + if ((params->action_mask & + (1LLU << RTE_TABLE_ACTION_TAG)) == 0) + return rte_flow_error_set(error, + ENOTSUP, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, + "MARK action not supported by this table"); + + n_mark = 1; + + /* RTE_TABLE_ACTION_TAG */ + rule_action->tag.tag = conf->id; + rule_action->action_mask |= 1 << RTE_TABLE_ACTION_TAG; + break; + } /* RTE_FLOW_ACTION_TYPE_MARK */ + case RTE_FLOW_ACTION_TYPE_METER: { const struct rte_flow_action_meter *conf = action->conf; From patchwork Thu Oct 11 11:41:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 46611 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 4B16E1B58F; Thu, 11 Oct 2018 13:42:01 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 63A131B515 for ; Thu, 11 Oct 2018 13:41:48 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2018 04:41:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,368,1534834800"; d="scan'208";a="94289070" Received: from silpixa00382658.ir.intel.com ([10.237.223.29]) by fmsmga002.fm.intel.com with ESMTP; 11 Oct 2018 04:41:38 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Date: Thu, 11 Oct 2018 12:41:15 +0100 Message-Id: <1539258078-85906-5-git-send-email-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539258078-85906-1-git-send-email-cristian.dumitrescu@intel.com> References: <1539258078-85906-1-git-send-email-cristian.dumitrescu@intel.com> Subject: [dpdk-dev] [PATCH v4 5/8] pipeline: add table action for packet decap 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" This patch introduces a new table action for packet decapsulation which removes n bytes from the start of the input packet. The n is read from the current table entry. The following mbuf fields are updated by the action: data_off, data_len, pkt_len. Signed-off-by: Cristian Dumitrescu --- lib/librte_pipeline/rte_table_action.c | 111 +++++++++++++++++++++++++++++++++ lib/librte_pipeline/rte_table_action.h | 12 ++++ 2 files changed, 123 insertions(+) diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index fb7eaf9..537e659 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -2056,6 +2056,83 @@ pkt4_work_tag(struct rte_mbuf *mbuf0, } /** + * RTE_TABLE_ACTION_DECAP + */ +struct decap_data { + uint16_t n; +} __attribute__((__packed__)); + +static int +decap_apply(struct decap_data *data, + struct rte_table_action_decap_params *p) +{ + data->n = p->n; + return 0; +} + +static __rte_always_inline void +pkt_work_decap(struct rte_mbuf *mbuf, + struct decap_data *data) +{ + uint16_t data_off = mbuf->data_off; + uint16_t data_len = mbuf->data_len; + uint32_t pkt_len = mbuf->pkt_len; + uint16_t n = data->n; + + mbuf->data_off = data_off + n; + mbuf->data_len = data_len - n; + mbuf->pkt_len = pkt_len - n; +} + +static __rte_always_inline void +pkt4_work_decap(struct rte_mbuf *mbuf0, + struct rte_mbuf *mbuf1, + struct rte_mbuf *mbuf2, + struct rte_mbuf *mbuf3, + struct decap_data *data0, + struct decap_data *data1, + struct decap_data *data2, + struct decap_data *data3) +{ + uint16_t data_off0 = mbuf0->data_off; + uint16_t data_len0 = mbuf0->data_len; + uint32_t pkt_len0 = mbuf0->pkt_len; + + uint16_t data_off1 = mbuf1->data_off; + uint16_t data_len1 = mbuf1->data_len; + uint32_t pkt_len1 = mbuf1->pkt_len; + + uint16_t data_off2 = mbuf2->data_off; + uint16_t data_len2 = mbuf2->data_len; + uint32_t pkt_len2 = mbuf2->pkt_len; + + uint16_t data_off3 = mbuf3->data_off; + uint16_t data_len3 = mbuf3->data_len; + uint32_t pkt_len3 = mbuf3->pkt_len; + + uint16_t n0 = data0->n; + uint16_t n1 = data1->n; + uint16_t n2 = data2->n; + uint16_t n3 = data3->n; + + mbuf0->data_off = data_off0 + n0; + mbuf0->data_len = data_len0 - n0; + mbuf0->pkt_len = pkt_len0 - n0; + + mbuf1->data_off = data_off1 + n1; + mbuf1->data_len = data_len1 - n1; + mbuf1->pkt_len = pkt_len1 - n1; + + mbuf2->data_off = data_off2 + n2; + mbuf2->data_len = data_len2 - n2; + mbuf2->pkt_len = pkt_len2 - n2; + + mbuf3->data_off = data_off3 + n3; + mbuf3->data_len = data_len3 - n3; + mbuf3->pkt_len = pkt_len3 - n3; +} + +/** * Action profile */ static int @@ -2073,6 +2150,7 @@ action_valid(enum rte_table_action_type action) case RTE_TABLE_ACTION_TIME: case RTE_TABLE_ACTION_SYM_CRYPTO: case RTE_TABLE_ACTION_TAG: + case RTE_TABLE_ACTION_DECAP: return 1; default: return 0; @@ -2210,6 +2288,9 @@ action_data_size(enum rte_table_action_type action, case RTE_TABLE_ACTION_TAG: return sizeof(struct tag_data); + case RTE_TABLE_ACTION_DECAP: + return sizeof(struct decap_data); + default: return 0; } @@ -2471,6 +2552,10 @@ rte_table_action_apply(struct rte_table_action *action, return tag_apply(action_data, action_params); + case RTE_TABLE_ACTION_DECAP: + return decap_apply(action_data, + action_params); + default: return -EINVAL; } @@ -2801,6 +2886,14 @@ pkt_work(struct rte_mbuf *mbuf, dscp); } + if (cfg->action_mask & (1LLU << RTE_TABLE_ACTION_DECAP)) { + void *data = action_data_get(table_entry, + action, + RTE_TABLE_ACTION_DECAP); + + pkt_work_decap(mbuf, data); + } + if (cfg->action_mask & (1LLU << RTE_TABLE_ACTION_ENCAP)) { void *data = action_data_get(table_entry, action, RTE_TABLE_ACTION_ENCAP); @@ -3034,6 +3127,24 @@ pkt4_work(struct rte_mbuf **mbufs, dscp3); } + if (cfg->action_mask & (1LLU << RTE_TABLE_ACTION_DECAP)) { + void *data0 = action_data_get(table_entry0, + action, + RTE_TABLE_ACTION_DECAP); + void *data1 = action_data_get(table_entry1, + action, + RTE_TABLE_ACTION_DECAP); + void *data2 = action_data_get(table_entry2, + action, + RTE_TABLE_ACTION_DECAP); + void *data3 = action_data_get(table_entry3, + action, + RTE_TABLE_ACTION_DECAP); + + pkt4_work_decap(mbuf0, mbuf1, mbuf2, mbuf3, + data0, data1, data2, data3); + } + if (cfg->action_mask & (1LLU << RTE_TABLE_ACTION_ENCAP)) { void *data0 = action_data_get(table_entry0, action, RTE_TABLE_ACTION_ENCAP); diff --git a/lib/librte_pipeline/rte_table_action.h b/lib/librte_pipeline/rte_table_action.h index 5dbb147..c960612 100644 --- a/lib/librte_pipeline/rte_table_action.h +++ b/lib/librte_pipeline/rte_table_action.h @@ -99,6 +99,9 @@ enum rte_table_action_type { /** Tag. */ RTE_TABLE_ACTION_TAG, + + /** Packet decapsulations. */ + RTE_TABLE_ACTION_DECAP, }; /** Common action configuration (per table action profile). */ @@ -783,6 +786,15 @@ struct rte_table_action_tag_params { }; /** + * RTE_TABLE_ACTION_DECAP + */ +/** Decap action parameters (per table rule). */ +struct rte_table_action_decap_params { + /** Number of bytes to be removed from the start of the packet. */ + uint16_t n; +}; + +/** * Table action profile. */ struct rte_table_action_profile; From patchwork Thu Oct 11 11:41:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 46606 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 1ABB91B55D; Thu, 11 Oct 2018 13:41:53 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 52E0C1B515 for ; Thu, 11 Oct 2018 13:41:47 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2018 04:41:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,368,1534834800"; d="scan'208";a="94289074" Received: from silpixa00382658.ir.intel.com ([10.237.223.29]) by fmsmga002.fm.intel.com with ESMTP; 11 Oct 2018 04:41:38 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Date: Thu, 11 Oct 2018 12:41:16 +0100 Message-Id: <1539258078-85906-6-git-send-email-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539258078-85906-1-git-send-email-cristian.dumitrescu@intel.com> References: <1539258078-85906-1-git-send-email-cristian.dumitrescu@intel.com> Subject: [dpdk-dev] [PATCH v4 6/8] examples/ip_pipeline: add support for packet decap table action 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" Add support for packet decap table action. Signed-off-by: Cristian Dumitrescu --- examples/ip_pipeline/action.c | 11 +++++++++++ examples/ip_pipeline/cli.c | 39 ++++++++++++++++++++++++++++++++++++++- examples/ip_pipeline/pipeline.h | 1 + examples/ip_pipeline/thread.c | 10 ++++++++++ 4 files changed, 60 insertions(+), 1 deletion(-) diff --git a/examples/ip_pipeline/action.c b/examples/ip_pipeline/action.c index 3f825a0..d2104aa 100644 --- a/examples/ip_pipeline/action.c +++ b/examples/ip_pipeline/action.c @@ -355,6 +355,17 @@ table_action_profile_create(const char *name, } } + if (params->action_mask & (1LLU << RTE_TABLE_ACTION_DECAP)) { + status = rte_table_action_profile_action_register(ap, + RTE_TABLE_ACTION_DECAP, + NULL); + + 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); diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index a85d04c..d1e5540 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -1033,7 +1033,8 @@ static const char cmd_table_action_profile_help[] = " [sym_crypto dev offset " " mempool_create \n" " mempool_init ]\n" -" [tag]\n"; +" [tag]\n" +" [decap]\n"; static void cmd_table_action_profile(char **tokens, @@ -1457,6 +1458,11 @@ cmd_table_action_profile(char **tokens, t0 += 1; } /* tag */ + if ((t0 < n_tokens) && (strcmp(tokens[t0], "decap") == 0)) { + p.action_mask |= 1LLU << RTE_TABLE_ACTION_DECAP; + t0 += 1; + } /* decap */ + if (t0 < n_tokens) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); return; @@ -3114,6 +3120,7 @@ parse_match(char **tokens, * digest_size * data_offset ] * [tag ] + * [decap ] * * where: * ::= g | y | r | drop @@ -4091,6 +4098,22 @@ parse_table_action_tag(char **tokens, } static uint32_t +parse_table_action_decap(char **tokens, + uint32_t n_tokens, + struct table_rule_action *a) +{ + if ((n_tokens < 2) || + strcmp(tokens[0], "decap")) + return 0; + + if (parser_read_uint16(&a->decap.n, tokens[1])) + return 0; + + a->action_mask |= 1 << RTE_TABLE_ACTION_DECAP; + return 2; +} + +static uint32_t parse_table_action(char **tokens, uint32_t n_tokens, char *out, @@ -4261,6 +4284,20 @@ parse_table_action(char **tokens, n_tokens -= n; } + if (n_tokens && (strcmp(tokens[0], "decap") == 0)) { + uint32_t n; + + n = parse_table_action_decap(tokens, n_tokens, a); + if (n == 0) { + snprintf(out, out_size, MSG_ARG_INVALID, + "action decap"); + return 0; + } + + tokens += n; + n_tokens -= n; + } + if (n_tokens0 - n_tokens == 1) { snprintf(out, out_size, MSG_ARG_INVALID, "action"); return 0; diff --git a/examples/ip_pipeline/pipeline.h b/examples/ip_pipeline/pipeline.h index 73485f6..e5b1d5d 100644 --- a/examples/ip_pipeline/pipeline.h +++ b/examples/ip_pipeline/pipeline.h @@ -283,6 +283,7 @@ struct table_rule_action { struct rte_table_action_time_params time; struct rte_table_action_sym_crypto_params sym_crypto; struct rte_table_action_tag_params tag; + struct rte_table_action_decap_params decap; }; int diff --git a/examples/ip_pipeline/thread.c b/examples/ip_pipeline/thread.c index 41891f4..4bd971f 100644 --- a/examples/ip_pipeline/thread.c +++ b/examples/ip_pipeline/thread.c @@ -2504,6 +2504,16 @@ action_convert(struct rte_table_action *a, return status; } + if (action->action_mask & (1LLU << RTE_TABLE_ACTION_DECAP)) { + status = rte_table_action_apply(a, + data, + RTE_TABLE_ACTION_DECAP, + &action->decap); + + if (status) + return status; + } + return 0; } From patchwork Thu Oct 11 11:41:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 46609 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 8DAAD1B57E; Thu, 11 Oct 2018 13:41:58 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id C98431B53E for ; Thu, 11 Oct 2018 13:41:47 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2018 04:41:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,368,1534834800"; d="scan'208";a="94289076" Received: from silpixa00382658.ir.intel.com ([10.237.223.29]) by fmsmga002.fm.intel.com with ESMTP; 11 Oct 2018 04:41:39 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Date: Thu, 11 Oct 2018 12:41:17 +0100 Message-Id: <1539258078-85906-7-git-send-email-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539258078-85906-1-git-send-email-cristian.dumitrescu@intel.com> References: <1539258078-85906-1-git-send-email-cristian.dumitrescu@intel.com> Subject: [dpdk-dev] [PATCH v4 7/8] net/softnic: add support for packet decap table action 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" Add support for packet decap table action. Signed-off-by: Cristian Dumitrescu --- drivers/net/softnic/rte_eth_softnic_action.c | 11 +++++++ drivers/net/softnic/rte_eth_softnic_cli.c | 38 +++++++++++++++++++++++++ drivers/net/softnic/rte_eth_softnic_internals.h | 1 + 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 133dd06..2b74848 100644 --- a/drivers/net/softnic/rte_eth_softnic_action.c +++ b/drivers/net/softnic/rte_eth_softnic_action.c @@ -375,6 +375,17 @@ softnic_table_action_profile_create(struct pmd_internals *p, } } + if (params->action_mask & (1LLU << RTE_TABLE_ACTION_DECAP)) { + status = rte_table_action_profile_action_register(ap, + RTE_TABLE_ACTION_DECAP, + NULL); + + 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); diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c index 31c37da..2ddd936 100644 --- a/drivers/net/softnic/rte_eth_softnic_cli.c +++ b/drivers/net/softnic/rte_eth_softnic_cli.c @@ -1280,6 +1280,7 @@ cmd_port_in_action_profile(struct pmd_internals *softnic, * [stats pkts | bytes | both] * [time] * [tag] + * [decap] */ static void cmd_table_action_profile(struct pmd_internals *softnic, @@ -1617,6 +1618,12 @@ cmd_table_action_profile(struct pmd_internals *softnic, t0 += 1; } /* tag */ + if (t0 < n_tokens && + (strcmp(tokens[t0], "decap") == 0)) { + p.action_mask |= 1LLU << RTE_TABLE_ACTION_DECAP; + t0 += 1; + } /* decap */ + if (t0 < n_tokens) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); return; @@ -3184,6 +3191,7 @@ parse_match(char **tokens, * [stats] * [time] * [tag ] + * [decap ] * * where: * ::= g | y | r | drop @@ -3690,6 +3698,22 @@ parse_table_action_tag(char **tokens, } static uint32_t +parse_table_action_decap(char **tokens, + uint32_t n_tokens, + struct softnic_table_rule_action *a) +{ + if (n_tokens < 2 || + strcmp(tokens[0], "decap")) + return 0; + + if (softnic_parser_read_uint16(&a->decap.n, tokens[1])) + return 0; + + a->action_mask |= 1 << RTE_TABLE_ACTION_DECAP; + return 2; +} + +static uint32_t parse_table_action(char **tokens, uint32_t n_tokens, char *out, @@ -3847,6 +3871,20 @@ parse_table_action(char **tokens, n_tokens -= n; } + if (n_tokens && (strcmp(tokens[0], "decap") == 0)) { + uint32_t n; + + n = parse_table_action_decap(tokens, n_tokens, a); + if (n == 0) { + snprintf(out, out_size, MSG_ARG_INVALID, + "action decap"); + return 0; + } + + tokens += n; + n_tokens -= n; + } + if (n_tokens0 - n_tokens == 1) { snprintf(out, out_size, MSG_ARG_INVALID, "action"); return 0; diff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h index 1623ff8..9aa19a9 100644 --- a/drivers/net/softnic/rte_eth_softnic_internals.h +++ b/drivers/net/softnic/rte_eth_softnic_internals.h @@ -898,6 +898,7 @@ struct softnic_table_rule_action { struct rte_table_action_stats_params stats; struct rte_table_action_time_params time; struct rte_table_action_tag_params tag; + struct rte_table_action_decap_params decap; }; struct rte_flow { diff --git a/drivers/net/softnic/rte_eth_softnic_thread.c b/drivers/net/softnic/rte_eth_softnic_thread.c index e1d002e..c8a8d23 100644 --- a/drivers/net/softnic/rte_eth_softnic_thread.c +++ b/drivers/net/softnic/rte_eth_softnic_thread.c @@ -2488,6 +2488,16 @@ action_convert(struct rte_table_action *a, return status; } + if (action->action_mask & (1LLU << RTE_TABLE_ACTION_DECAP)) { + status = rte_table_action_apply(a, + data, + RTE_TABLE_ACTION_DECAP, + &action->decap); + + if (status) + return status; + } + return 0; } From patchwork Thu Oct 11 11:41:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 46605 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 DAD001B54C; Thu, 11 Oct 2018 13:41:50 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id AD2301B53E for ; Thu, 11 Oct 2018 13:41:46 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2018 04:41:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,368,1534834800"; d="scan'208";a="94289078" Received: from silpixa00382658.ir.intel.com ([10.237.223.29]) by fmsmga002.fm.intel.com with ESMTP; 11 Oct 2018 04:41:40 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Date: Thu, 11 Oct 2018 12:41:18 +0100 Message-Id: <1539258078-85906-8-git-send-email-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539258078-85906-1-git-send-email-cristian.dumitrescu@intel.com> References: <1539258078-85906-1-git-send-email-cristian.dumitrescu@intel.com> Subject: [dpdk-dev] [PATCH v4 8/8] net/softnic: add support for flow api vxlan decap action 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" Add support for ethdev flow API VXLAN decap action. Signed-off-by: Cristian Dumitrescu --- drivers/net/softnic/rte_eth_softnic_flow.c | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/net/softnic/rte_eth_softnic_flow.c b/drivers/net/softnic/rte_eth_softnic_flow.c index 9bb0d56..23ef329 100644 --- a/drivers/net/softnic/rte_eth_softnic_flow.c +++ b/drivers/net/softnic/rte_eth_softnic_flow.c @@ -1169,6 +1169,7 @@ flow_rule_action_get(struct pmd_internals *softnic, int n_jump_queue_rss_drop = 0; int n_count = 0; int n_mark = 0; + int n_vxlan_decap = 0; profile = softnic_table_action_profile_find(softnic, table->params.action_profile_name); @@ -1510,6 +1511,40 @@ flow_rule_action_get(struct pmd_internals *softnic, break; } /* RTE_FLOW_ACTION_TYPE_MARK */ + case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP: + { + const struct rte_flow_action_mark *conf = action->conf; + + if (conf) + return rte_flow_error_set(error, + EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + action, + "VXLAN DECAP: Non-null configuration"); + + if (n_vxlan_decap) + return rte_flow_error_set(error, + ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, + action, + "Only one VXLAN DECAP action per flow"); + + if ((params->action_mask & + (1LLU << RTE_TABLE_ACTION_DECAP)) == 0) + return rte_flow_error_set(error, + ENOTSUP, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, + "VXLAN DECAP action not supported by this table"); + + n_vxlan_decap = 1; + + /* RTE_TABLE_ACTION_DECAP */ + rule_action->decap.n = 50; /* Ether/IPv4/UDP/VXLAN */ + rule_action->action_mask |= 1 << RTE_TABLE_ACTION_DECAP; + break; + } /* RTE_FLOW_ACTION_TYPE_VXLAN_DECAP */ + case RTE_FLOW_ACTION_TYPE_METER: { const struct rte_flow_action_meter *conf = action->conf;