From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20051.outbound.protection.outlook.com [40.107.2.51]) by dpdk.org (Postfix) with ESMTP id 02B0D1B419 for ; Tue, 25 Dec 2018 07:30:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GYshb7l5wneKKlWRQwt0iTd8MaPBa/sNs94eiHPIPB0=; b=TMgeHGVl5sjmdvUMrkgqIBMM/m1lVgmKgh6sqbz7zaEiuu1CWSpSifiitg3SFHF+Ps5zfrrGKqwfK73qwEFLGgdmuJ3a0c6woYdH6Nany/R8x2qph+o9qnxbhsjaCVssy3AGm7255PntOMcAkr2fpe5p+4dOVaWj6BlJI9hJ7pc= Received: from VI1PR05MB4224.eurprd05.prod.outlook.com (52.133.12.13) by VI1PR05MB4463.eurprd05.prod.outlook.com (52.133.13.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1446.19; Tue, 25 Dec 2018 06:30:44 +0000 Received: from VI1PR05MB4224.eurprd05.prod.outlook.com ([fe80::ccd2:91aa:36ef:630e]) by VI1PR05MB4224.eurprd05.prod.outlook.com ([fe80::ccd2:91aa:36ef:630e%2]) with mapi id 15.20.1446.026; Tue, 25 Dec 2018 06:30:44 +0000 From: Dekel Peled To: Ori Kam CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] examples/flow_filtering: fix example documentation Thread-Index: AQHUnAF3+uSw/UsSwEyVKEUYRBD7/KWO/Iew Date: Tue, 25 Dec 2018 06:30:44 +0000 Message-ID: References: <1545648636-36614-1-git-send-email-dekelp@mellanox.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=dekelp@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR05MB4463; 6:0GCNQQC9Mu+213lztCOYshhBtyZ3J1AiFo1f0rLq4kPSa3MBUABtGAi6l+JV7xebyT6zoidkqzQT88ZWOqfBavVwUa3jzZg85og7hdFVUn6sXbfKdAb+WW7WKyBIFEXECRtOrTJRr3g/uAKIa94HDJ4ubj8XuBA8xkFulZsTeAn6062f8dhEUsKh+G45kKsXYT8GlvODYAG7gbEvW/H4IevsVe/S74tWj4M5DuztQJSacSy4U3N0qkTcSIvvvwxZ69CQDFMtn3qK3nOZ4ZUuVYvmIWlt9Dz9F9CEbpIQ2pu4tOvcSjozTvszMcesbq+tZNgZACtYwB/YeNtMAPRcCgLFNoVjJI4WAwNaGtfLmqr6LBIAIJfM9EdnA6QSyF0duwJ6YXtoKmc6dGU815LYCWU6nmsYmLW6XdbO7l2hNXMosldRZbrdAvWIMG8k+TlkrEAZJFL1bvGx3N2U/ujlmA==; 5:luiKIUQnz26m+i53io+KfMcbZNNYG+0+r9ONEsmCWFB0T3pU7qncogj1grd4S6017lcGMjFzer7DL5IeKEkbbdIBdssZUfMBpX/7+NlYAKQqvyizAFv7CWrMdMgKsDRQkDYu5dFEji5d1R3b21on/V2fzvxFmFTUIg5ysvhb5wk=; 7:F1xiNT9CrkGqLHZxl4KZwSjRA4F25Lj52GyoupUMbxA8IXc1jLuUa3vRltxF2Vg3ajKdij1VUZkUDpQP0UKq8MXVVaqLkQCpPGmnlpaQaeDv0TBmxRrgiI+AAeLXmMo1/K4zSQ80NdYGnd7LWBya3Q== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: e280b5d6-2d5a-4db1-497f-08d66a327fa9 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4463; x-ms-traffictypediagnostic: VI1PR05MB4463: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(2401047)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231475)(944501520)(52105112)(6055026)(6041310)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:VI1PR05MB4463; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4463; x-forefront-prvs: 08978A8F5C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(366004)(346002)(39860400002)(376002)(136003)(199004)(13464003)(189003)(4326008)(86362001)(7736002)(316002)(81166006)(486006)(81156014)(478600001)(2906002)(99286004)(476003)(446003)(33656002)(5660300001)(9686003)(53936002)(7696005)(6246003)(6862004)(8936002)(105586002)(11346002)(71190400001)(71200400001)(106356001)(305945005)(74316002)(6506007)(55016002)(76176011)(14454004)(229853002)(102836004)(53546011)(14444005)(256004)(6436002)(68736007)(26005)(6636002)(186003)(97736004)(25786009)(3846002)(6116002)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4463; H:VI1PR05MB4224.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 6YlGicjJ58/ZLCmzxArIZ9FuRuxGkKRElC2IeUutlQ7G3oedO2kFMPp3y4F2LV5rQdpHNpHk6zqn3UYJq8dg84vVHxFEEs8vsS37ggRmem1ZsL/w0VkVskBD6RYFKA8SI/ygK8Lfcx9MBT4DyqxG/2hH5Un/oQ+9rrrFeW/Y+YG8tNZdQEyahTis9/6UUYu6F0NvRHAWT18lGS/q8IA7zmfBcxuta9T+mA6D1X1tBdpMDGHJn4JtDFG9Ic9DNCTrRJCvQyr5oPmVji7Gc4XVDDa0A/CBo7ttbbjjQeR1viNqtx7puG1Gq4sBlK1s+LBV spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e280b5d6-2d5a-4db1-497f-08d66a327fa9 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Dec 2018 06:30:44.1363 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4463 Subject: Re: [dpdk-dev] [PATCH] examples/flow_filtering: fix example documentation 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: , X-List-Received-Date: Tue, 25 Dec 2018 06:30:46 -0000 PSB. > -----Original Message----- > From: Ori Kam > Sent: Tuesday, December 25, 2018 5:25 AM > To: Dekel Peled > Cc: dev@dpdk.org; Dekel Peled > Subject: RE: [dpdk-dev] [PATCH] examples/flow_filtering: fix example > documentation >=20 >=20 >=20 > > -----Original Message----- > > From: dev On Behalf Of Dekel Peled > > Sent: Monday, December 24, 2018 12:51 PM > > To: Ori Kam > > Cc: dev@dpdk.org; Dekel Peled > > Subject: [dpdk-dev] [PATCH] examples/flow_filtering: fix example > > documentation > > > > Previous patch removed the VLAN item from example code. > > This patch fixes the documentation accordingly. >=20 > So why are you modifying the c file? >=20 The doc file quotes the c file, needed to modify both to align doc with cod= e. Code change includes fix of comments, and removing redundant variables and = their initialization. > > > > Fixes: 9af4eb565710 ("examples/flow_filtering: remove VLAN item") > > Cc: orika@mellanox.com > > > > Signed-off-by: Dekel Peled > > --- > > 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 840d557..9dba85a 100644 > > --- a/doc/guides/sample_app_ug/flow_filtering.rst > > +++ b/doc/guides/sample_app_ug/flow_filtering.rst > > @@ -53,7 +53,7 @@ applications and the Environment Abstraction Layer > > (EAL) options. > > 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. > > > > @@ -380,13 +380,9 @@ 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 =3D NULL; > > struct rte_flow_action_queue queue =3D { .index =3D 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; > > > > @@ -404,37 +400,19 @@ This function is located in the ``flow_blocks.c``= file. > > * create the action sequence. > > * one action only, move packet to queue > > */ > > - > > action[0].type =3D RTE_FLOW_ACTION_TYPE_QUEUE; > > action[0].conf =3D &queue; > > action[1].type =3D RTE_FLOW_ACTION_TYPE_END; > > > > /* > > - * 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 =3D 0; > > - eth_mask.type =3D 0; > > pattern[0].type =3D RTE_FLOW_ITEM_TYPE_ETH; > > - pattern[0].spec =3D ð_spec; > > - pattern[0].mask =3D ð_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 =3D RTE_FLOW_ITEM_TYPE_VLAN; > > - pattern[1].spec =3D &vlan_spec; > > - pattern[1].mask =3D &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. > > */ > > @@ -444,12 +422,12 @@ This function is located in the ``flow_blocks.c``= file. > > ip_mask.hdr.dst_addr =3D dest_mask; > > ip_spec.hdr.src_addr =3D htonl(src_ip); > > ip_mask.hdr.src_addr =3D src_mask; > > - pattern[2].type =3D RTE_FLOW_ITEM_TYPE_IPV4; > > - pattern[2].spec =3D &ip_spec; > > - pattern[2].mask =3D &ip_mask; > > + pattern[1].type =3D RTE_FLOW_ITEM_TYPE_IPV4; > > + pattern[1].spec =3D &ip_spec; > > + pattern[1].mask =3D &ip_mask; > > > > /* the final level must be always type end */ > > - pattern[3].type =3D RTE_FLOW_ITEM_TYPE_END; > > + pattern[2].type =3D RTE_FLOW_ITEM_TYPE_END; > > > > int res =3D rte_flow_validate(port_id, &attr, pattern, acti= on, error); > > if(!res) > > @@ -464,14 +442,10 @@ 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 =3D { .index =3D 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; > > > > @@ -491,33 +465,17 @@ the rule. In this case send the packet to queue. > > action[0].conf =3D &queue; > > action[1].type =3D 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. > > > > 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 =3D 0; > > - eth_mask.type =3D 0; > > pattern[0].type =3D RTE_FLOW_ITEM_TYPE_ETH; > > - pattern[0].spec =3D ð_spec; > > - pattern[0].mask =3D ð_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 =3D RTE_FLOW_ITEM_TYPE_VLAN; > > - pattern[1].spec =3D &vlan_spec; > > - pattern[1].mask =3D &vlan_mask; > > > > -Setting the third level ip: > > +Setting the second level of the pattern IP: > > > > .. code-block:: c > > > > @@ -527,15 +485,15 @@ Setting the third level ip: > > ip_mask.hdr.dst_addr =3D dest_mask; > > ip_spec.hdr.src_addr =3D htonl(src_ip); > > ip_mask.hdr.src_addr =3D src_mask; > > - pattern[2].type =3D RTE_FLOW_ITEM_TYPE_IPV4; > > - pattern[2].spec =3D &ip_spec; > > - pattern[2].mask =3D &ip_mask; > > + pattern[1].type =3D RTE_FLOW_ITEM_TYPE_IPV4; > > + pattern[1].spec =3D &ip_spec; > > + pattern[1].mask =3D &ip_mask; > > > > Closing the pattern part. > > > > .. code-block:: c > > > > - pattern[3].type =3D RTE_FLOW_ITEM_TYPE_END; > > + pattern[2].type =3D 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 bae7116..1edf6f9 100644 > > --- a/examples/flow_filtering/flow_blocks.c > > +++ b/examples/flow_filtering/flow_blocks.c > > @@ -2,7 +2,8 @@ > > * Copyright 2017 Mellanox Technologies, Ltd > > */ > > > > -#define MAX_PATTERN_NUM 4 > > +#define MAX_PATTERN_NUM 3 > > +#define MAX_ACTION_NUM 2 > > > > struct rte_flow * > > generate_ipv4_flow(uint16_t port_id, uint16_t rx_q, @@ -41,11 +42,9 > > @@ struct rte_flow * { > > 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 =3D NULL; > > struct rte_flow_action_queue queue =3D { .index =3D 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; > > int res; > > @@ -64,26 +63,19 @@ struct rte_flow * > > * create the action sequence. > > * one action only, move packet to queue > > */ > > - > > action[0].type =3D RTE_FLOW_ACTION_TYPE_QUEUE; > > action[0].conf =3D &queue; > > action[1].type =3D RTE_FLOW_ACTION_TYPE_END; > > > > /* > > - * 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 =3D 0; > > - eth_mask.type =3D 0; > > pattern[0].type =3D RTE_FLOW_ITEM_TYPE_ETH; > > - pattern[0].spec =3D ð_spec; > > - pattern[0].mask =3D ð_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. > > */ > > -- > > 1.8.3.1 >=20 >=20 > Thanks, > Ori