From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 5064A1B45D for ; Thu, 31 Jan 2019 16:50:41 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B1441C070477; Thu, 31 Jan 2019 15:50:40 +0000 (UTC) Received: from ktraynor.remote.csb (ovpn-117-200.ams2.redhat.com [10.36.117.200]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29EC45C23E; Thu, 31 Jan 2019 15:50:37 +0000 (UTC) From: Kevin Traynor To: Dekel Peled Cc: Ori Kam , dpdk stable Date: Thu, 31 Jan 2019 15:48:41 +0000 Message-Id: <20190131154901.5383-33-ktraynor@redhat.com> In-Reply-To: <20190131154901.5383-1-ktraynor@redhat.com> References: <20190131154901.5383-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 31 Jan 2019 15:50:40 +0000 (UTC) Subject: [dpdk-stable] patch 'examples/flow_filtering: fix example documentation' has been queued to LTS release 18.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2019 15:50:41 -0000 Hi, FYI, your patch has been queued to LTS release 18.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/07/19. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Kevin Traynor --- >>From 6917704c7d09ff160237903d6d787fa109c8e923 Mon Sep 17 00:00:00 2001 From: Dekel Peled Date: Tue, 25 Dec 2018 09:42:18 +0200 Subject: [PATCH] examples/flow_filtering: fix example documentation [ upstream commit d67b3f11d352544063fbdf2a8232563d88870d6a ] Previous patch removed the VLAN item from example code. This patch fixes the code and documentation accordingly. Code update includes fix of comments, and removal of redundant variables and their initialization. Documentation update reflects the code changes done in previous patch and in this patch. Fixes: 9af4eb565710 ("examples/flow_filtering: remove VLAN item") Signed-off-by: Dekel Peled Acked-by: Ori Kam --- doc/guides/sample_app_ug/flow_filtering.rst | 74 +++++---------------- examples/flow_filtering/flow_blocks.c | 18 ++--- 2 files changed, 21 insertions(+), 71 deletions(-) diff --git a/doc/guides/sample_app_ug/flow_filtering.rst b/doc/guides/sample_app_ug/flow_filtering.rst index 840d557c5..9dba85acf 100644 --- a/doc/guides/sample_app_ug/flow_filtering.rst +++ b/doc/guides/sample_app_ug/flow_filtering.rst @@ -54,5 +54,5 @@ Explanation ----------- -The example is build from 2 main files, +The example is built from 2 files, ``main.c`` which holds the example logic and ``flow_blocks.c`` that holds the implementation for building the flow rule. @@ -381,11 +381,7 @@ This function is located in the ``flow_blocks.c`` file. struct rte_flow_attr attr; struct rte_flow_item pattern[MAX_PATTERN_NUM]; - struct rte_flow_action action[MAX_PATTERN_NUM]; + struct rte_flow_action action[MAX_ACTION_NUM]; struct rte_flow *flow = NULL; struct rte_flow_action_queue queue = { .index = rx_q }; - struct rte_flow_item_eth eth_spec; - struct rte_flow_item_eth eth_mask; - struct rte_flow_item_vlan vlan_spec; - struct rte_flow_item_vlan vlan_mask; struct rte_flow_item_ipv4 ip_spec; struct rte_flow_item_ipv4 ip_mask; @@ -405,5 +401,4 @@ This function is located in the ``flow_blocks.c`` file. * one action only, move packet to queue */ - action[0].type = RTE_FLOW_ACTION_TYPE_QUEUE; action[0].conf = &queue; @@ -411,29 +406,12 @@ This function is located in the ``flow_blocks.c`` file. /* - * set the first level of the pattern (eth). + * set the first level of the pattern (ETH). * since in this example we just want to get the * ipv4 we set this level to allow all. */ - memset(ð_spec, 0, sizeof(struct rte_flow_item_eth)); - memset(ð_mask, 0, sizeof(struct rte_flow_item_eth)); - eth_spec.type = 0; - eth_mask.type = 0; pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH; - pattern[0].spec = ð_spec; - pattern[0].mask = ð_mask; /* - * setting the second level of the pattern (vlan). - * since in this example we just want to get the - * ipv4 we also set this level to allow all. - */ - memset(&vlan_spec, 0, sizeof(struct rte_flow_item_vlan)); - memset(&vlan_mask, 0, sizeof(struct rte_flow_item_vlan)); - pattern[1].type = RTE_FLOW_ITEM_TYPE_VLAN; - pattern[1].spec = &vlan_spec; - pattern[1].mask = &vlan_mask; - - /* - * setting the third level of the pattern (ip). + * setting the second level of the pattern (IP). * in this example this is the level we care about * so we set it according to the parameters. @@ -445,10 +423,10 @@ This function is located in the ``flow_blocks.c`` file. ip_spec.hdr.src_addr = htonl(src_ip); ip_mask.hdr.src_addr = src_mask; - pattern[2].type = RTE_FLOW_ITEM_TYPE_IPV4; - pattern[2].spec = &ip_spec; - pattern[2].mask = &ip_mask; + pattern[1].type = RTE_FLOW_ITEM_TYPE_IPV4; + pattern[1].spec = &ip_spec; + pattern[1].mask = &ip_mask; /* the final level must be always type end */ - pattern[3].type = RTE_FLOW_ITEM_TYPE_END; + pattern[2].type = RTE_FLOW_ITEM_TYPE_END; int res = rte_flow_validate(port_id, &attr, pattern, action, error); @@ -465,12 +443,8 @@ The first part of the function is declaring the structures that will be used. struct rte_flow_attr attr; struct rte_flow_item pattern[MAX_PATTERN_NUM]; - struct rte_flow_action action[MAX_PATTERN_NUM]; + struct rte_flow_action action[MAX_ACTION_NUM]; struct rte_flow *flow; struct rte_flow_error error; struct rte_flow_action_queue queue = { .index = rx_q }; - struct rte_flow_item_eth eth_spec; - struct rte_flow_item_eth eth_mask; - struct rte_flow_item_vlan vlan_spec; - struct rte_flow_item_vlan vlan_mask; struct rte_flow_item_ipv4 ip_spec; struct rte_flow_item_ipv4 ip_mask; @@ -492,6 +466,6 @@ the rule. In this case send the packet to queue. action[1].type = RTE_FLOW_ACTION_TYPE_END; -The forth part is responsible for creating the pattern and is build from -number of step. In each step we build one level of the pattern starting with +The fourth part is responsible for creating the pattern and is built from +number of steps. In each step we build one level of the pattern starting with the lowest one. @@ -500,23 +474,7 @@ Setting the first level of the pattern ETH: .. code-block:: c - memset(ð_spec, 0, sizeof(struct rte_flow_item_eth)); - memset(ð_mask, 0, sizeof(struct rte_flow_item_eth)); - eth_spec.type = 0; - eth_mask.type = 0; pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH; - pattern[0].spec = ð_spec; - pattern[0].mask = ð_mask; -Setting the second level of the pattern VLAN: - -.. code-block:: c - - memset(&vlan_spec, 0, sizeof(struct rte_flow_item_vlan)); - memset(&vlan_mask, 0, sizeof(struct rte_flow_item_vlan)); - pattern[1].type = RTE_FLOW_ITEM_TYPE_VLAN; - pattern[1].spec = &vlan_spec; - pattern[1].mask = &vlan_mask; - -Setting the third level ip: +Setting the second level of the pattern IP: .. code-block:: c @@ -528,7 +486,7 @@ Setting the third level ip: ip_spec.hdr.src_addr = htonl(src_ip); ip_mask.hdr.src_addr = src_mask; - pattern[2].type = RTE_FLOW_ITEM_TYPE_IPV4; - pattern[2].spec = &ip_spec; - pattern[2].mask = &ip_mask; + pattern[1].type = RTE_FLOW_ITEM_TYPE_IPV4; + pattern[1].spec = &ip_spec; + pattern[1].mask = &ip_mask; Closing the pattern part. @@ -536,5 +494,5 @@ Closing the pattern part. .. code-block:: c - pattern[3].type = RTE_FLOW_ITEM_TYPE_END; + pattern[2].type = RTE_FLOW_ITEM_TYPE_END; The last part of the function is to validate the rule and create it. diff --git a/examples/flow_filtering/flow_blocks.c b/examples/flow_filtering/flow_blocks.c index bae711699..1edf6f9c6 100644 --- a/examples/flow_filtering/flow_blocks.c +++ b/examples/flow_filtering/flow_blocks.c @@ -3,5 +3,6 @@ */ -#define MAX_PATTERN_NUM 4 +#define MAX_PATTERN_NUM 3 +#define MAX_ACTION_NUM 2 struct rte_flow * @@ -42,9 +43,7 @@ generate_ipv4_flow(uint16_t port_id, uint16_t rx_q, struct rte_flow_attr attr; struct rte_flow_item pattern[MAX_PATTERN_NUM]; - struct rte_flow_action action[MAX_PATTERN_NUM]; + struct rte_flow_action action[MAX_ACTION_NUM]; struct rte_flow *flow = NULL; struct rte_flow_action_queue queue = { .index = rx_q }; - struct rte_flow_item_eth eth_spec; - struct rte_flow_item_eth eth_mask; struct rte_flow_item_ipv4 ip_spec; struct rte_flow_item_ipv4 ip_mask; @@ -65,5 +64,4 @@ generate_ipv4_flow(uint16_t port_id, uint16_t rx_q, * one action only, move packet to queue */ - action[0].type = RTE_FLOW_ACTION_TYPE_QUEUE; action[0].conf = &queue; @@ -71,18 +69,12 @@ generate_ipv4_flow(uint16_t port_id, uint16_t rx_q, /* - * set the first level of the pattern (eth). + * set the first level of the pattern (ETH). * since in this example we just want to get the * ipv4 we set this level to allow all. */ - memset(ð_spec, 0, sizeof(struct rte_flow_item_eth)); - memset(ð_mask, 0, sizeof(struct rte_flow_item_eth)); - eth_spec.type = 0; - eth_mask.type = 0; pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH; - pattern[0].spec = ð_spec; - pattern[0].mask = ð_mask; /* - * setting the third level of the pattern (ip). + * setting the second level of the pattern (IP). * in this example this is the level we care about * so we set it according to the parameters. -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-01-31 15:44:06.514407309 +0000 +++ 0033-examples-flow_filtering-fix-example-documentation.patch 2019-01-31 15:44:05.000000000 +0000 @@ -1,8 +1,10 @@ -From d67b3f11d352544063fbdf2a8232563d88870d6a Mon Sep 17 00:00:00 2001 +From 6917704c7d09ff160237903d6d787fa109c8e923 Mon Sep 17 00:00:00 2001 From: Dekel Peled Date: Tue, 25 Dec 2018 09:42:18 +0200 Subject: [PATCH] examples/flow_filtering: fix example documentation +[ upstream commit d67b3f11d352544063fbdf2a8232563d88870d6a ] + Previous patch removed the VLAN item from example code. This patch fixes the code and documentation accordingly. @@ -12,7 +14,6 @@ patch and in this patch. Fixes: 9af4eb565710 ("examples/flow_filtering: remove VLAN item") -Cc: stable@dpdk.org Signed-off-by: Dekel Peled Acked-by: Ori Kam