From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40086.outbound.protection.outlook.com [40.107.4.86]) by dpdk.org (Postfix) with ESMTP id 807C3343C for ; Tue, 25 Dec 2018 04:25:21 +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=i4jiCzh2nkSfVW2yMpPM3GeNUCfEi6BsXEDJrfRPrYA=; b=v/Q3sKwJojnw4m/Jtqyj0/qKg3WrFhxLnkZXbFeW83wtDBBAQUOToM5ogh8f0H781d2OqwZViXLAAspj2r6LgA5YIzVWR5h2hhuhernVlua8fYOt1O2qTGQUnMV6GQniYpOVAiEXIxU9NGPiMKRF+X2VfquZoa/sLmpwCZBWfe8= Received: from AM4PR05MB3425.eurprd05.prod.outlook.com (10.171.187.142) by AM4PR05MB3124.eurprd05.prod.outlook.com (10.171.186.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1446.23; Tue, 25 Dec 2018 03:25:19 +0000 Received: from AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::e086:6fd:7477:c605]) by AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::e086:6fd:7477:c605%3]) with mapi id 15.20.1446.027; Tue, 25 Dec 2018 03:25:19 +0000 From: Ori Kam To: Dekel Peled CC: "dev@dpdk.org" , Dekel Peled Thread-Topic: [dpdk-dev] [PATCH] examples/flow_filtering: fix example documentation Thread-Index: AQHUm32cYI7s5inAO0C+JhZ54uWjAKWOy0hA Date: Tue, 25 Dec 2018 03:25:19 +0000 Message-ID: References: <1545648636-36614-1-git-send-email-dekelp@mellanox.com> In-Reply-To: <1545648636-36614-1-git-send-email-dekelp@mellanox.com> 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=orika@mellanox.com; x-originating-ip: [42.120.102.174] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR05MB3124; 6:jVBNj2VQYNPdddFSd/5xpO+vYQr8hCBxBf7mhHipj5pcIc2ICvzJnq5EsMcyW+iI9nK+6q/dM8B9cqR8MtLB0pqQIrJFqe59apyzo4Rs+7+Pl7w50ixvaQ/PVqRbhnjqhrI9LqxI5ScOCyCOpH0z61V32aLoOTYiMTovfkKLL1FLJVi7kXWBn37m7CQT5ObGADfYQbm6AFm5k3D49PPAUlgD8VVjO8bCs7FtAZEHYRF7r4LUcbxvDAQEtvPgKwUTDtBMIwM/x1T0c0n4ObPaFVZ2w+R4RBeXMp/4JdN3Ej0Hdx0YfzhgyNsdhzYTRds8lr8RSq+Z4jB2aaXlToC2F61U9LSwXRphdgHDRRcfROFKUdv+1gcBLyCQz7WkGhQese0V4VBkALdkpal38rwEjrb9WPDbqWsThUVV6cAYSjEOfy4caaQJ1QTZKXaShYW9JdbM8kvWWCuINei3Ya3GBg==; 5:jV6r/I98A5NzQP8QjtxBXvqvNiGyURjn6of09NY5BJt324aG17S0fPT40CKTEDRaxaL1CzP9JbihU0bNlr58hW2pyhj+evPcBYWl4xBwa9uq0Qxn5oBFiTXFoJE3EiefwRVtWNOkjK3kpQvbp5PrVuVZfTWFUxaXsED78hHEBYk=; 7:iR7BiM8sY7XkNEkFsiLVFawNVB6LhbDxbpR7pCi2DRtk88giF5mhcu2gEZMsYWVlL1wvYpnRWYp9peOSojn700YDGtEEnvPc8mnSaCSoy+ZzSdXIXqFDGwjRGLWsOMmUfpl6XjjJBlSt8RlxWa5h+g== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: b1b0bd99-21f3-4acc-7448-08d66a1898f8 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:AM4PR05MB3124; x-ms-traffictypediagnostic: AM4PR05MB3124: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(2401047)(8121501046)(93006095)(93001095)(3231475)(944501520)(52105112)(3002001)(10201501046)(6055026)(6041310)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM4PR05MB3124; BCL:0; PCL:0; RULEID:; SRVR:AM4PR05MB3124; x-forefront-prvs: 08978A8F5C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(346002)(376002)(136003)(39860400002)(189003)(199004)(13464003)(8936002)(53936002)(81156014)(81166006)(107886003)(6246003)(229853002)(6506007)(53546011)(106356001)(105586002)(33656002)(316002)(99286004)(4326008)(74316002)(54906003)(2906002)(305945005)(6436002)(9686003)(68736007)(6862004)(76176011)(7696005)(55016002)(6636002)(3846002)(6116002)(186003)(97736004)(5660300001)(7736002)(66066001)(256004)(14444005)(86362001)(102836004)(478600001)(26005)(476003)(71200400001)(25786009)(446003)(71190400001)(14454004)(486006)(11346002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3124; H:AM4PR05MB3425.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: BfVVM2NayOV2tUUVFAOU+EIuA3ZEdDgkQmfo3GQRCj785TbJ+z5nLlaauIqMn94cAo7BX+TcwiReED+clFfir8WS7aHHGG0STFq6J5+c8iO8CbOMKS9RlhvhLACZuzyhPWJoR8aIzAm6F07qRS6MmIFNjhRpgf6QtGQ8OjVEZfgQtjag9uotycKaB2Zqu5glQMLrbYg4sFSNFd1GDQCE3oruRSQ+eQay8LicQsDsajQccEOcOX4s8nTNVyk8R/v6nMxaWZb/DIU64MDGnas34M4GFqVyUYKZry4zMBoWnBQTDOnX26QXqBOzayOe3Ur0 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: b1b0bd99-21f3-4acc-7448-08d66a1898f8 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Dec 2018 03:25:19.5801 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3124 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 03:25:21 -0000 > -----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 >=20 > Previous patch removed the VLAN item from example code. > This patch fixes the documentation accordingly. So why are you modifying the c file? >=20 > Fixes: 9af4eb565710 ("examples/flow_filtering: remove VLAN item") > Cc: orika@mellanox.com >=20 > 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(-) >=20 > 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 > ----------- >=20 > -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 hold= s the > implementation for building the flow rule. >=20 > @@ -380,13 +380,9 @@ This function is located in the ``flow_blocks.c`` fi= le. > { > 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; >=20 > @@ -404,37 +400,19 @@ This function is located in the ``flow_blocks.c`` f= ile. > * 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; >=20 > /* > - * 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; >=20 > /* > - * 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`` f= ile. > 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; >=20 > /* 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; >=20 > int res =3D rte_flow_validate(port_id, &attr, pattern, action= , error); > if(!res) > @@ -464,14 +442,10 @@ The first part of the function is declaring the > structures that will be used. >=20 > 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; >=20 > @@ -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; >=20 > -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 fro= m > +number of steps. In each step we build one level of the pattern starting= with > the lowest one. >=20 > Setting the first level of the pattern ETH: >=20 > .. code-block:: c >=20 > - 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; >=20 > -Setting the third level ip: > +Setting the second level of the pattern IP: >=20 > .. code-block:: c >=20 > @@ -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; >=20 > Closing the pattern part. >=20 > .. code-block:: c >=20 > - pattern[3].type =3D RTE_FLOW_ITEM_TYPE_END; > + pattern[2].type =3D RTE_FLOW_ITEM_TYPE_END; >=20 > The last part of the function is to validate the rule and create it. >=20 > 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 > */ >=20 > -#define MAX_PATTERN_NUM 4 > +#define MAX_PATTERN_NUM 3 > +#define MAX_ACTION_NUM 2 >=20 > 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; >=20 > /* > - * 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; >=20 > /* > - * 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 Thanks, Ori