From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 682DEA04B7; Sun, 4 Oct 2020 13:22:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DD2271BA5D; Sun, 4 Oct 2020 13:22:23 +0200 (CEST) Received: from nat-hk.nvidia.com (nat-hk.nvidia.com [203.18.50.4]) by dpdk.org (Postfix) with ESMTP id 97FEF1B868 for ; Sun, 4 Oct 2020 13:22:21 +0200 (CEST) Received: from HKMAIL103.nvidia.com (Not Verified[10.18.92.100]) by nat-hk.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Sun, 04 Oct 2020 19:22:19 +0800 Received: from HKMAIL101.nvidia.com (10.18.16.10) by HKMAIL103.nvidia.com (10.18.16.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Sun, 4 Oct 2020 11:21:59 +0000 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.170) by HKMAIL101.nvidia.com (10.18.16.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Sun, 4 Oct 2020 11:21:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mLBOssGQIqaBCqjAnDFoQ0hzQBAPqiqClf2s3jFUfpDw4Z2aIxjKZyiYGoFo+BScQ2n/ogtTdmqx/XEkH3n+RQmsUUUtDK0l09sSH3uHy0EpOon7/2WFpMv+OR8AhbAcpD8Dg28E9uDaEXtxYy2Ej6FnZqktNy/Xtni9s+UKp2C+PaI9X35rkxn/UthcKsjC2dSYhShZwhsycR2ErmHvV8Zg5Cl/1TzRA27utqoaz0uWLGM51XkLeIR2v8aDiiAuHeZ9BpN4WJodhOiwa9q76+vOOkrTaOaaXct7EZ416FB7CPo89YC86Y80D9R0CnQmiGT0t8kRts8Yt+95TNl4NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lXyeWFZaZHEngafbjpMojNPaG0FLhAF2KIJDW5zULYA=; b=ZgrNyHjshiD1jQt0uF16ko5CBm2Se4iipgngBMMHmebBnRpOXFTn59v5wP40rO3IUTUEjakzMYdoAiEUB6mkPuAhwQJ9ssqFsAUzjUkI8YVv93fFThPlbeGRwVIw1DUNWrfILgoaVXDB4wj9dS+pq7M49BYFXTgHKrj1VXy+/knBZ5GmU/PzHUFKWssjULySVSPfmQCR1irI/q6YK1fjik4Slt/xbM4ol3db0KB8RuzJEVCcg9mbbGk+1a2w1qzIGTJ0/DXo/8q6VuDtQ+Gg7pbkl1IoEcSNA4q1KYeo7EFOclv/HqrFnqC8NeeVHdQgRMKuHbSlDapKXJmKQkk3/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none Received: from MN2PR12MB4286.namprd12.prod.outlook.com (2603:10b6:208:199::22) by MN2PR12MB3872.namprd12.prod.outlook.com (2603:10b6:208:168::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.38; Sun, 4 Oct 2020 11:21:55 +0000 Received: from MN2PR12MB4286.namprd12.prod.outlook.com ([fe80::61fd:a36e:cf4f:2d3f]) by MN2PR12MB4286.namprd12.prod.outlook.com ([fe80::61fd:a36e:cf4f:2d3f%8]) with mapi id 15.20.3433.042; Sun, 4 Oct 2020 11:21:55 +0000 From: Ori Kam To: Andrey Vesnovaty , "dev@dpdk.org" CC: "jer@marvell.com" , "jerinjacobk@gmail.com" , NBU-Contact-Thomas Monjalon , "ferruh.yigit@intel.com" , "stephen@networkplumber.org" , "bruce.richardson@intel.com" , Slava Ovsiienko , "andrey.vesnovaty@gmail.com" , "mdr@ashroe.eu" , "nhorman@tuxdriver.com" , "ajit.khaparde@broadcom.com" , "samik.gupta@broadcom.com" , Andrey Vesnovaty , "Marko Kovacevic" , Ori Kam , "Radu Nicolau" , Akhil Goyal , "Tomasz Kantecki" , Sunil Kumar Kori , Pavan Nikhilesh , John McNamara Thread-Topic: [PATCH v3 09/10] examples/flow_filtering: utilize shared RSS action Thread-Index: AQHWmdGzTrbUtI7JrE6hq8gs6ZvI26mHTGXw Date: Sun, 4 Oct 2020 11:21:55 +0000 Message-ID: References: <20201003220619.19231-1-andreyv@nvidia.com> <20201003220619.19231-10-andreyv@nvidia.com> In-Reply-To: <20201003220619.19231-10-andreyv@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [147.236.152.129] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d2cc6724-f262-4ab5-23e0-08d86857b386 x-ms-traffictypediagnostic: MN2PR12MB3872: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:91; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RJ25DbkOIetE+TXP9iLzf7a9ekBSOSrOQISzE3d862t8SrC/p659HnMpxq1De2g7/w/r/KTpLhlXF4snujXeq/+R6cDJ9NLqfrmxA55PL8ttEIrCXqLwXUbE3DsTmtNzRJTFYtodAEl2so/WYdbGpSzBzQAv/GJNc03shM1iIevnrE5Bp5iuc3taBTtky1413PwQLWoJ7jlo92zvI//2YUSo8CEJgOS+3J8Aza+Q+M0vido93o7QunGRZcABlflBVEQDxdKSn7JPcLlXmOJcN0qg+RuBjUOeSWLw86Y61BCREGHB6+bKnfmMHSMnla89VQkPc6Jyvxub+9AtmbEG7g== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR12MB4286.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(376002)(39860400002)(396003)(366004)(316002)(64756008)(8676002)(33656002)(66946007)(66446008)(66476007)(110136005)(76116006)(8936002)(54906003)(71200400001)(66556008)(86362001)(478600001)(26005)(186003)(30864003)(5660300002)(4326008)(7696005)(2906002)(6506007)(53546011)(52536014)(83380400001)(7416002)(9686003)(55016002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: J1jTf4Yho43gnvvLjuPqN+hV6gS0aZU2bTyz/FNLe7xCX0JlLbZE/7/TwHRAKn5q2m+BTYTKarDe9s37rVBWXmeWJ0rHKFGCu0ddyHHHC8E+6sywxLm2RUjTdCDVu2vI/Lee3AJbZ7y3dqIHaQlEW9WjeMV63S08jUuL3y0nb8ddTtlrKMTvfvvhohJ8MbzNBk45DpGQ2VXKF+VKtN+sG8ycO2LPK4X+DQD3xf+YGNQWU9nqKXOzvViPyARKya4WrDj+rccn2u8D5w8tvROqeSHxerkppN/MDQ9FYkpnEGDgzO4ux5hLDY3WY0nadUuvSnUU4LiCiT/l9T8it1ZcxaLnU3GeodQkacWjCKdqelnu9ug1zEdnmzwcmhs+R/uAjmVuLR4AheETThzYoR5GUZMjwmMm2x4/AztyXOmWl1+CcWO4R5xOACCO4OY0tQQTagK8H8bDCnFhT1bBP1Krg6rSuNCrpdxDcmZJrOIExVmfumcAKyn+3GOjY8P8Bqe1ZsXPXcUAFNe0m0ZQXBoJlyzslRCJTbcQ6pHT5NVHeutHmM61Q/UC0HDps1DcEPZZqTws+Q/pyzWfB8z1JLfklK46lGTXzS1brWKJ8tWXuGOSN2ecT66DRCwAUFILlU7jpuWerNjJdMqG779KoYARWg== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4286.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2cc6724-f262-4ab5-23e0-08d86857b386 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Oct 2020 11:21:55.3861 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: lKzKS6zSIDAPWYF/Pufdv3vLmRKYKA6LgFkkHTYH3NDlZlkKbKOGw/5w4NEjLvuAkmzhSaSQlWd8DZ1nd7WHDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3872 X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1601810539; bh=lXyeWFZaZHEngafbjpMojNPaG0FLhAF2KIJDW5zULYA=; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To: CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References: In-Reply-To:Accept-Language:Content-Language:X-MS-Has-Attach: X-MS-TNEF-Correlator:authentication-results:x-originating-ip: x-ms-publictraffictype:x-ms-office365-filtering-correlation-id: x-ms-traffictypediagnostic:x-ld-processed: x-ms-exchange-transport-forked:x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers:x-ms-exchange-senderadcheck: x-microsoft-antispam:x-microsoft-antispam-message-info: x-forefront-antispam-report:x-ms-exchange-antispam-messagedata: Content-Type:Content-Transfer-Encoding:MIME-Version: X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-AuthSource: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-originalarrivaltime: X-MS-Exchange-CrossTenant-fromentityheader: X-MS-Exchange-CrossTenant-id:X-MS-Exchange-CrossTenant-mailboxtype: X-MS-Exchange-CrossTenant-userprincipalname: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg; b=fhdLzxhxKVu7oRpf++SFiYMIA1tFdfnQeO2vwD2ZuJTuakOyOFOWuBp0iSb0GIyXm XlWYDQXGHKA4vMwc+6JZoVmLtSYBok3uIwj8qJlRD0nZnQRKwLaOKwLRKd/s9v9nQi eKgi7XJhohyhCc7Owo5CCmRo/jynWn+kMTrfvctGeR1pksKROtuF8y+GI0koYBsorg Rc6IyTnVJo82wvMNZfOYr8AzOSZVfwE40rY+23HO9y0zKREgzUrut9ZSl0h/dxxxQi kwgY82KCmTqohboqdlpvmogPds5PVC04geTXMbNPQ8RR0ZMqawF/AHdTiSE9qV17Sp ar7dg1zhaKuPg== Subject: Re: [dpdk-dev] [PATCH v3 09/10] examples/flow_filtering: utilize shared RSS 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" Hi Andrey, I don't think this change should be part of the series. After you update this example will only work if the PMD support shared acti= on. Not all PMD supports it, and in any case this example is to show basic rule= s and RSS your code changes the app that the RSS action can't be checked. Best, Ori =20 > -----Original Message----- > From: Andrey Vesnovaty > Sent: Sunday, October 4, 2020 1:06 AM > Subject: [PATCH v3 09/10] examples/flow_filtering: utilize shared RSS act= ion >=20 > From: Andrey Vesnovaty >=20 > This commit give very first shared RSS action usage example. > Queue action used by the flow replaced by shared RSS action > having single queue. On each RX burst queue switched 0 <-> 1 > utilizing rte_flow_shared_action_update() API. User supposed > to observe consistent queue switches on each packet burst. >=20 > Signed-off-by: Andrey Vesnovaty > Signed-off-by: Andrey Vesnovaty > --- > doc/guides/sample_app_ug/flow_filtering.rst | 62 +++++++++++++--- > examples/flow_filtering/flow_blocks.c | 81 +++++++++++++++++---- > examples/flow_filtering/main.c | 13 +++- > 3 files changed, 128 insertions(+), 28 deletions(-) >=20 > diff --git a/doc/guides/sample_app_ug/flow_filtering.rst > b/doc/guides/sample_app_ug/flow_filtering.rst > index 5e5a6cd8a0..cfe9334717 100644 > --- a/doc/guides/sample_app_ug/flow_filtering.rst > +++ b/doc/guides/sample_app_ug/flow_filtering.rst > @@ -106,7 +106,7 @@ following code: > .. code-block:: c >=20 > /* create flow for send packet with */ > - flow =3D generate_ipv4_flow(port_id, selected_queue, > + flow =3D generate_ipv4_flow(port_id, shared_action, > SRC_IP, EMPTY_MASK, > DEST_IP, FULL_MASK, &error); > if (!flow) { > @@ -242,7 +242,7 @@ The Ethernet port is configured with default settings > using the > rxq_conf =3D dev_info.default_rxconf; > rxq_conf.offloads =3D port_conf.rxmode.offloads; >=20 > -For this example we are configuring number of rx and tx queues that are > connected > +For this example we are configuring 2 rx and 2 tx queues that are connec= ted > to a single port. >=20 > .. code-block:: c > @@ -270,13 +270,22 @@ to a single port. > } > } >=20 > +Before we create the flow we create shared action in order to send it as > +actions argument when creating a flow. The action is single queue RSS ac= tion > +similar to action queue with the only difference that shared RSS action > +provides update capability after action creation. > + > +.. code-block:: c > + > + shared_action =3D rte_flow_shared_action_create(port_id, &action, &er= ror); > + > In the next step we create and apply the flow rule. which is to send pac= kets > with destination ip equals to 192.168.1.1 to queue number 1. The detail > explanation of the ``generate_ipv4_flow()`` appears later in this docume= nt: >=20 > .. code-block:: c >=20 > - flow =3D generate_ipv4_flow(port_id, selected_queue, > + flow =3D generate_ipv4_flow(port_id, shared_action, > SRC_IP, EMPTY_MASK, > DEST_IP, FULL_MASK, &error); >=20 > @@ -339,6 +348,21 @@ looks like the following: > printf("\n"); > rte_pktmbuf_free(m); > } > + if (rss_queue[0] =3D=3D 0) { > + printf(">>> switching queue 0= -> 1\n"); > + rss_queue[0] =3D 1; > + } else { > + printf(">>> switching queue 1= -> 0\n"); > + rss_queue[0] =3D 0; > + } > + ret =3D rte_flow_shared_action_update > + (port_id, shared_action, &act= ion, > + &error); > + if (ret) > + rte_exit(EXIT_FAILURE, > + ":: error: RSS actio= n update " > + "failed: %s\n", > + rte_strerror(-ret)); > } > } > } > @@ -348,6 +372,8 @@ looks like the following: > rte_eth_dev_close(port_id); > } >=20 > +On each loop eteration Rx queue switched using > +``rte_flow_shared_action_update()`` API. > The main work of the application is reading the packets from all > queues and printing for each packet the destination queue: >=20 > @@ -365,6 +391,21 @@ queues and printing for each packet the destination > queue: > printf(" - queue=3D0x%x", (unsigned int)i); > printf("\n"); > rte_pktmbuf_free(m); > + if (rss_queue[0] =3D=3D 0) { > + printf(">>> switching queue 0 -> 1\= n"); > + rss_queue[0] =3D 1; > + } else { > + printf(">>> switching queue 1 -> 0\= n"); > + rss_queue[0] =3D 0; > + } > + ret =3D rte_flow_shared_action_update > + (port_id, shared_action, &action, > + &error); > + if (ret) > + rte_exit(EXIT_FAILURE, > + ":: error: RSS action upda= te " > + "failed: %s\n", > + rte_strerror(-ret)); > } > } > } > @@ -378,13 +419,15 @@ The forwarding loop can be interrupted and the > application closed using > The generate_ipv4_flow function > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >=20 > + > The generate_ipv4_flow function is responsible for creating the flow rul= e. > This function is located in the ``flow_blocks.c`` file. >=20 > .. code-block:: c >=20 > static struct rte_flow * > - generate_ipv4_flow(uint8_t port_id, uint16_t rx_q, > + generate_ipv4_flow(uint8_t port_id, > + cstructrte_flow_shared_action *shared_action, > uint32_t src_ip, uint32_t src_mask, > uint32_t dest_ip, uint32_t dest_mask, > struct rte_flow_error *error) > @@ -393,7 +436,6 @@ This function is located in the ``flow_blocks.c`` fil= e. > struct rte_flow_item pattern[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_ipv4 ip_spec; > struct rte_flow_item_ipv4 ip_mask; >=20 > @@ -411,8 +453,8 @@ This function is located in the ``flow_blocks.c`` fil= e. > * 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[0].type =3D RTE_FLOW_ACTION_TYPE_SHARED; > + action[0].conf =3D shared_action; > action[1].type =3D RTE_FLOW_ACTION_TYPE_END; >=20 > /* > @@ -468,12 +510,12 @@ The following part create the flow attributes, in o= ur > case ingress. > attr.ingress =3D 1; >=20 > The third part defines the action to be taken when a packet matches > -the rule. In this case send the packet to queue. > +the rule. In this case send the packet to single RSS queue. >=20 > .. code-block:: c >=20 > - action[0].type =3D RTE_FLOW_ACTION_TYPE_QUEUE; > - action[0].conf =3D &queue; > + action[0].type =3D RTE_FLOW_ACTION_TYPE_SHARED; > + action[0].conf =3D shared_action; > action[1].type =3D RTE_FLOW_ACTION_TYPE_END; >=20 > The fourth part is responsible for creating the pattern and is built fro= m > diff --git a/examples/flow_filtering/flow_blocks.c > b/examples/flow_filtering/flow_blocks.c > index 575d792810..ed17ae073e 100644 > --- a/examples/flow_filtering/flow_blocks.c > +++ b/examples/flow_filtering/flow_blocks.c > @@ -5,12 +5,30 @@ > #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, > - uint32_t src_ip, uint32_t src_mask, > - uint32_t dest_ip, uint32_t dest_mask, > - struct rte_flow_error *error); > +struct rte_flow_shared_action *shared_action; > +uint16_t rss_queue[1] =3D {0}; > + > +struct rte_flow_action_rss rss_action =3D { > + .func =3D RTE_ETH_HASH_FUNCTION_DEFAULT, > + .level =3D 0, > + .types =3D 0, > + .key_len =3D 0, > + .key =3D NULL, > + .queue =3D rss_queue, > + .queue_num =3D 1, > +}; >=20 > +struct rte_flow_action flow_action =3D { > + .type =3D RTE_FLOW_ACTION_TYPE_RSS, > + .conf =3D &rss_action, > +}; > + > +struct rte_flow * > +generate_ipv4_flow(uint16_t port_id, > + uint32_t src_ip, uint32_t src_mask, > + uint32_t dest_ip, uint32_t dest_mask, > + struct rte_flow_error *error); > +int update_rss_action(uint16_t port_id, struct rte_flow_error *error); >=20 > /** > * create a flow rule that sends packets with matching src and dest ip > @@ -18,8 +36,6 @@ generate_ipv4_flow(uint16_t port_id, uint16_t rx_q, > * > * @param port_id > * The selected port. > - * @param rx_q > - * The selected target queue. > * @param src_ip > * The src ip value to match the input packet. > * @param src_mask > @@ -35,16 +51,15 @@ generate_ipv4_flow(uint16_t port_id, uint16_t rx_q, > * A flow if the rule could be created else return NULL. > */ > struct rte_flow * > -generate_ipv4_flow(uint16_t port_id, uint16_t rx_q, > - uint32_t src_ip, uint32_t src_mask, > - uint32_t dest_ip, uint32_t dest_mask, > - struct rte_flow_error *error) > +generate_ipv4_flow(uint16_t port_id, > + uint32_t src_ip, uint32_t src_mask, > + uint32_t dest_ip, uint32_t dest_mask, > + struct rte_flow_error *error) > { > struct rte_flow_attr attr; > struct rte_flow_item pattern[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_ipv4 ip_spec; > struct rte_flow_item_ipv4 ip_mask; > int res; > @@ -61,10 +76,19 @@ generate_ipv4_flow(uint16_t port_id, uint16_t rx_q, >=20 > /* > * create the action sequence. > - * one action only, move packet to queue > + * one action only, move packet to shared RSS queue > */ > - action[0].type =3D RTE_FLOW_ACTION_TYPE_QUEUE; > - action[0].conf =3D &queue; > + shared_action =3D rte_flow_shared_action_create(port_id, NULL, > + &flow_action, error); > + if (shared_action) { > + action[0].conf =3D shared_action; > + action[0].type =3D RTE_FLOW_ACTION_TYPE_SHARED; > + } else { > + if (rte_errno !=3D ENOSYS) > + rte_exit(EXIT_FAILURE, ":: action creation failure\n"); > + printf("PMD doesn't support shared actions.\n"); > + action[0] =3D flow_action; > + } > action[1].type =3D RTE_FLOW_ACTION_TYPE_END; >=20 > /* > @@ -98,3 +122,30 @@ generate_ipv4_flow(uint16_t port_id, uint16_t rx_q, >=20 > return flow; > } > + > +/** > + * updates shared RSS action if flow created with shared action > + * > + * @param port_id > + * The selected port. > + * @param[out] error > + * Perform verbose error reporting if not NULL. > + * > + * @return > + * 0 on sccess > + */ > +int > +update_rss_action(uint16_t port_id, struct rte_flow_error *error) > +{ > + if (!shared_action) > + return 0; > + if (rss_queue[0] =3D=3D 0) { > + printf(">>> switching queue 0 -> 1\n"); > + rss_queue[0] =3D 1; > + } else { > + printf(">>> switching queue 1 -> 0\n"); > + rss_queue[0] =3D 0; > + } > + return rte_flow_shared_action_update(port_id, shared_action, > + &flow_action, error); > +} > diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/mai= n.c > index cc9e7e7808..9ef7f099d9 100644 > --- a/examples/flow_filtering/main.c > +++ b/examples/flow_filtering/main.c > @@ -32,8 +32,7 @@ > static volatile bool force_quit; >=20 > static uint16_t port_id; > -static uint16_t nr_queues =3D 5; > -static uint8_t selected_queue =3D 1; > +static uint16_t nr_queues =3D 2; > struct rte_mempool *mbuf_pool; > struct rte_flow *flow; >=20 > @@ -61,6 +60,7 @@ main_loop(void) > uint16_t nb_rx; > uint16_t i; > uint16_t j; > + int ret; >=20 > while (!force_quit) { > for (i =3D 0; i < nr_queues; i++) { > @@ -82,6 +82,12 @@ main_loop(void) >=20 > rte_pktmbuf_free(m); > } > + ret =3D update_rss_action(port_id, &error); > + if (ret) > + rte_exit(EXIT_FAILURE, > + ":: error: RSS action update " > + "failed: %s\n", > + rte_strerror(-ret)); > } > } > } > @@ -243,8 +249,9 @@ main(int argc, char **argv) >=20 > init_port(); >=20 > + > /* create flow for send packet with */ > - flow =3D generate_ipv4_flow(port_id, selected_queue, > + flow =3D generate_ipv4_flow(port_id, > SRC_IP, EMPTY_MASK, > DEST_IP, FULL_MASK, &error); > if (!flow) { > -- > 2.26.2