From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10045.outbound.protection.outlook.com [40.107.1.45]) by dpdk.org (Postfix) with ESMTP id 423FB1B40F for ; Tue, 25 Dec 2018 07:37:54 +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=Ka3DQ6PFhYIgxGfQz7uM/PpqKXfHA3+SbB6OHdKuXvc=; b=PFXmK9BNFjQBBSr1RS1YyPGUdPWOexpqIsavxRQ+Q+uAmzzyOtdOU9Du41RxnL/Vqa1Awir61ekr4m6N3gyYPBmmqqUnb2GHN1xQ0DxsQ02y45ID+eNSSg9huyCo/Shf5xD7Y5jHNsn3ApSH03Oc75gBZhhcWcvAGpBpFERHPaQ= Received: from AM4PR05MB3425.eurprd05.prod.outlook.com (10.171.187.142) by AM4PR05MB3219.eurprd05.prod.outlook.com (10.171.186.140) 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:37:51 +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 06:37:51 +0000 From: Ori Kam To: Dekel Peled CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] examples/flow_filtering: fix example documentation Thread-Index: AQHUm32cYI7s5inAO0C+JhZ54uWjAKWOy0hAgAA0dgCAAACP4A== Date: Tue, 25 Dec 2018 06:37:51 +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=orika@mellanox.com; x-originating-ip: [42.120.102.174] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR05MB3219; 6:lZOtWVe1/XKzoZqxgXzxQp9R8Ki5b3/WxY/NAxWacwlpOZ8dnWRvyK0R/zkoHddIVnzfYJqf805iQQbbAOrPnG9CIdd/KTj9lz2l2LnIUq868hpkPa8eO7OKwOrivYPk6aEpax6gey/Iw0XmkSOWYOLH0RApZJCSRUz5ZcOEHHjgPTqUsqWxGWDIcTOeC+7T8rkrGFbram4B/IKhpEBGFmDfNvoykHq6Z9RwEX9x4lb/98DoWMrVS0ewjRCKwQOTnRetxDIbhzX3XckFpdb94F66qxLyEGNJpX5TBRkxOF4meEQ1FpvmfTZkW8sIQ503gjU72oozf51bQHCjhwE610zCzvCkDfgfZFRcaoF1DCDgGSk3d9xwMj9AXer6Nww+NepTbHnAQvggopValpnFYwTK1eyHY1m0OmO8Qj7nkBNPW60cjed/CCJSMo2MTcociQmRralWCPUcUdA8CgAUWg==; 5:3AD9hpv9NtoHd05H+7EpOBB2ILiu2Ruybrxb0t/jfmdI/eLxXL4Y7DQwaXBUL3v7hige0I7lX71eIDqUClQs1XRlpGMsCJZIrjTJ3MxXV3aU8sEKSQFTxtCaAQlmVcz8O3WQeJkhuKLgAGK0E+d7Kih3mG3/sPWDE5ghwKlyn8A=; 7:kkcKkzboaVR+ciATRB8WJqCmpZkrvndDv0u6UsUqMyt9RVA3a7RRrSXMdQRb44iIpHoIIerL2zP9kL7n7G83vW+4xwfN3Y1sL8+AUJcrZbouaEivq+BycT95r4+RrYSkEctbKYMrSD0zGjXWl43IKA== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: e99ff035-d8ff-45f8-bb73-08d66a337e6d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM4PR05MB3219; x-ms-traffictypediagnostic: AM4PR05MB3219: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(2401047)(8121501046)(3002001)(93006095)(93001095)(10201501046)(3231475)(944501520)(52105112)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:AM4PR05MB3219; BCL:0; PCL:0; RULEID:; SRVR:AM4PR05MB3219; x-forefront-prvs: 08978A8F5C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(136003)(366004)(39860400002)(346002)(376002)(13464003)(199004)(189003)(86362001)(4744004)(446003)(71200400001)(71190400001)(105586002)(97736004)(6862004)(99286004)(74316002)(6436002)(3846002)(6116002)(305945005)(33656002)(6636002)(14454004)(14444005)(256004)(11346002)(486006)(476003)(2906002)(6506007)(9686003)(26005)(186003)(81156014)(53546011)(102836004)(316002)(55016002)(76176011)(81166006)(7696005)(8936002)(5660300001)(478600001)(66066001)(53936002)(68736007)(6246003)(7736002)(4326008)(106356001)(25786009)(229853002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3219; H:AM4PR05MB3425.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: JLVSjRvoxdQUqxThDuwA/LWyAl0Ddk6I6KbI438nWhNqVd32JQpUqqox9pSzHdSdPUrH3e3kuAmUnzndy8LqmmQtZPWv14RWSdSRPD2eqptGRceqU5AZa+ows1cHFVK9Sz+MmT4bsxTPn6krm1yDS+FULInJMLhrD6tLscYgUtRpQQclMP71OrMtueQI8bMHtLbe0LdF8B9mUtPs0kXnJfwswfjheb/+ChFZN+91snRZOou0M1bSh1WSATy7cxXELMAo338gD8aE7DMAt8kGUtahFTodvUZHYpO0zfzdqT3ansx5zkKLnHFWO9Kl44j3 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: e99ff035-d8ff-45f8-bb73-08d66a337e6d X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Dec 2018 06:37:51.5099 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3219 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:37:54 -0000 PSB > -----Original Message----- > From: Dekel Peled > Sent: Tuesday, December 25, 2018 8:31 AM > To: Ori Kam > Cc: dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH] examples/flow_filtering: fix example > documentation >=20 > PSB. >=20 > > -----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 > > > > > > > > > -----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. > > > > So why are you modifying the c file? > > >=20 > The doc file quotes the c file, needed to modify both to align doc with c= ode. > Code change includes fix of comments, and removing redundant variables an= d > their initialization. >=20 Modify the H to match the C I agree.=20 Changing the C file is something else, since in order to make the H file ma= tch the C file you only need to change the H. If you also wish to do some code cleanup feel free, but make sure you are a= dding this also=20 to the commit log.=20 > > > > > > 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, ac= tion, 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 > > > > > > Thanks, > > Ori