From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00070.outbound.protection.outlook.com [40.107.0.70]) by dpdk.org (Postfix) with ESMTP id 035102BD5 for ; Thu, 7 Mar 2019 12:31:57 +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=nE0zYwxceXavLBOEYrXbtq+K002lW8ZPFFz178Rr4R4=; b=m/g5fsEJGVXVribtHA+TLHRIrzXzKrJXnfD0N2qa+N8SBDFovOXtuOzS2OFUxusu1TZYfbGFR+YPfUfQQTW0KlTctVPSCjGHJBjhue8/hvPtpFG7zLmrXK5uHxKUD2JSe/wwhaFQUAtgyx5qWrRDyIE3SFoza72/Jo/WqIIhSIA= Received: from AM6PR05MB5926.eurprd05.prod.outlook.com (20.179.2.27) by AM6PR05MB6181.eurprd05.prod.outlook.com (20.178.94.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.15; Thu, 7 Mar 2019 11:31:57 +0000 Received: from AM6PR05MB5926.eurprd05.prod.outlook.com ([fe80::a0b3:8140:c1f1:dd89]) by AM6PR05MB5926.eurprd05.prod.outlook.com ([fe80::a0b3:8140:c1f1:dd89%3]) with mapi id 15.20.1686.018; Thu, 7 Mar 2019 11:31:57 +0000 From: Raslan Darawsheh To: Andrew Bainbridge , users Thread-Topic: [dpdk-users] How to use .last and .spec fields in the Generic Flow API? Thread-Index: AdTULfMpOywd9MpSS1qLnFZ916l9YwAlAyJQAAUXpIAAAKrCoA== Date: Thu, 7 Mar 2019 11:31:57 +0000 Message-ID: References: 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=rasland@mellanox.com; x-originating-ip: [82.213.2.186] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 76b81eb6-8942-4157-3d36-08d6a2f081ba x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM6PR05MB6181; x-ms-traffictypediagnostic: AM6PR05MB6181: x-ms-exchange-purlcount: 1 x-microsoft-exchange-diagnostics: =?us-ascii?Q?1; AM6PR05MB6181; 23:SatWR/fbO1NpCVf3l+XVj5zuWQ1k2MNiHg3uct9kW?= =?us-ascii?Q?mQC4hsEoaR9jA8VO+Ee50yvRbDKc3igSlUGeCjQ5bAR1A5o3u7QcQT67acEZ?= =?us-ascii?Q?vZ1bSBRcs0xBkF7G9Jhz0YHmb2qLJm5zrSeGkYXtKOa/6FWOmb0cC9uxon62?= =?us-ascii?Q?Mu5BkzE1M4E6rdUFQebSRCB7Q514vJgNAXCFGuKM+lJYzLoJKmfjbScMfUnI?= =?us-ascii?Q?tpNNqgWvblRdF4ky4gAaUM/TDP01ZbGDAVApThohDWLvugbRwDYzcsL8e5pB?= =?us-ascii?Q?9PvhyGfraR9yc0i37sLEq/eJnijBbcRLxhIhZuNd0EfQC4vHaDHCzsLcP4Dy?= =?us-ascii?Q?Zit21ueIknDeQ0sWLMWpR3jTxr7RHhCdnGKlFodeUwqqLC/9wp6nF1eqKoJr?= =?us-ascii?Q?15A+RGfdR0VZNQ6XDNXIyj639zRLcYEPjVC/HZjQ2oaDR1MdFR82dG+BO2x+?= =?us-ascii?Q?7L4B9laWryoCAz7d9ZRE8boiAsoH/XOrkFVjJvugVRJ28q1H4lOkwja82JZO?= =?us-ascii?Q?sPPl5oXLaZwuinjMmlp9rsvj6aNZbZYsAhMonPEefHFoU27XkZc+cDFp7XKq?= =?us-ascii?Q?408Xb5L//ZPrAem2u5FUdHrqXiEfVD0tbBWwm295QA38w1pC2lXOJHjxRk5B?= =?us-ascii?Q?sLK1ki3cyVfbNl42enrwIboSB0xx+Lq9Z3xD5k3yXbqg1RJqy0NvKYtG/uQZ?= =?us-ascii?Q?J2xbShjU6iOgaEk1oGm0+64ASlIog9TPvd/CjIWrvkbPzvayhYvaKEhGqSNV?= =?us-ascii?Q?Oduo2i0asbBPibSPWtfFqmTUlJ2DNTk61EsyHInYMIHRLGJf3WSgV63+8fB8?= =?us-ascii?Q?G7zHH/irjD/Jk6ebhf1Ra5Stq06O37ic0eovB0Lw6SjR5YCE4bPAuQ4GMWIR?= =?us-ascii?Q?7mR6GwRsiAHATSt9CXn42kwt4/Z+mwb/DhLZdz2edjJEKEkgAZh33KwUcEA3?= =?us-ascii?Q?zcS0aY++HvIFk6J7902mLHxJmOjp8uKIg0HTsnqak1gkhVQQA8LOUQDzHhha?= =?us-ascii?Q?cNazLVe22rOhOjbPNgD81/6Y9cqW5oO1FJwCF6vYneswS0f157d1/rKW206u?= =?us-ascii?Q?XdoFXBcU8GcqsdArYWwPA9z5Yw8kTfqesoS2GJx6/5bfW2sxgtXyXFZaC7bW?= =?us-ascii?Q?Q/CdRIUBPEhXPPZJ1Y6aioM8wlnZf7Y0Fhxhwr4aMVIR5gMEya+aKTPWn0/X?= =?us-ascii?Q?NxryXslBqif+Scuxg2wSuL8M7ciyKbRFfJ8kPnYooVrO6vwBGWBfwWM3qOQD?= =?us-ascii?Q?8gg2CrokonisaSzbKm3sYZhFpNAq792B3CWMD54yZmIKaws7IGEwwlyQ1LK9?= =?us-ascii?Q?iBZ+rf2o/XGI3n5XfetJcNQezqxXnuPHUsDoDvKya5H?= x-microsoft-antispam-prvs: x-forefront-prvs: 096943F07A x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(346002)(376002)(136003)(366004)(39860400002)(13464003)(189003)(199004)(51914003)(52536013)(6436002)(66066001)(2906002)(106356001)(6506007)(476003)(256004)(25786009)(105586002)(1511001)(71200400001)(26005)(53936002)(97736004)(8936002)(14454004)(7736002)(305945005)(45080400002)(5660300002)(6246003)(71190400001)(229853002)(6306002)(76176011)(55016002)(81156014)(99286004)(86362001)(33656002)(81166006)(186003)(316002)(478600001)(110136005)(3846002)(53546011)(11346002)(6116002)(446003)(74316002)(7696005)(486006)(68736007)(102836004)(9686003)(41533002)(142923001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB6181; H:AM6PR05MB5926.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: bfRbypDnEvpRgYUInA9i0+e8ifFfQfdmT1Uib2eu3hTOFxjlpmIlv80ZcZLvcLk6mZMCSzbB2FTRT8iWdkChvoJeL0/ACKsFsvL2Kzr29vMDi8gDdWG/riKXQRTZn9ugKAinf3deYcEnrPWw7KpBAd2gvcnmjUC2x4oyNFnXuJYRdUsxsy2lGqgKQ76na9nAMynwLMn/MASasCdhWqhM3uWn+s8S/6UItq84y4MWGKOc4MhO4VHND5WNeOnKdcpo1rKsens3VbLTdhIj9qKjMswekT+vNJM4ZA4lTlX//t6wQbwjBEX7cf9GhIlAYCC5DYKMM1NpBC9pwa589hehlehU1dPhdCiZ5rMtQICLs+SU5T95636aaL90+e5G6g4R084jm7V4U1+JuHFhQUBuscOk4Eg6uOu+d6N2t11E1K0= 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: 76b81eb6-8942-4157-3d36-08d6a2f081ba X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Mar 2019 11:31:57.0589 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB6181 Subject: Re: [dpdk-users] How to use .last and .spec fields in the Generic Flow API? X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2019 11:31:58 -0000 Hi Andrew, I tried to explain it in general for last and mask. But, for MLX4 in general it can have support only for 0xffff mask or 0x0 ma= sk which mean that you can only do it for one port or any. This also applies for IPv4 and TCP items. So for the range you need to explicitly add a separate rule for each port t= hat you want. Kindest regards, Raslan Darawsheh > -----Original Message----- > From: Andrew Bainbridge > Sent: Thursday, March 7, 2019 1:10 PM > To: Raslan Darawsheh ; users > Subject: RE: [dpdk-users] How to use .last and .spec fields in the Generi= c > Flow API? >=20 > Hi Raslan >=20 > Thanks for the reply. It sounds very sensible. Unfortunately I can't get = it to > work. >=20 > If I do not set the mask, I get the "range between spec and last is large= r than > mask" error again. >=20 > If I set the mask to 0, then all udp dst port numbers are accepted. >=20 > If I set the mask to 0xff, I get, "mlx4 does not support matching partial= UDP > fields". >=20 > Do any of these work on the PMD you use? The generic flow docs > (https://emea01.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fdo > c.dpdk.org%2Fguides%2Fprog_guide%2Frte_flow.html&data=3D02%7C01 > %7Crasland%40mellanox.com%7Cb79d945b1a8d4597044f08d6a2ed8282%7Ca > 652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C636875538317844006&am > p;sdata=3DJk3US8esY0vlWXyWyDqyjWlYG4DzpQFERN7L864Xdo0%3D&res > erved=3D0 section 9.2.3) say, "mask is a simple bit-mask applied before > interpreting the contents of spec and last", which sort-of implies I need= to > set the mask to non-zero even when using "last". >=20 > I can't find any other relevant documentation or example code. >=20 > Thanks, > Andrew >=20 > -----Original Message----- > From: Raslan Darawsheh > Sent: 07 March 2019 08:52 > To: Andrew Bainbridge ; users > Subject: RE: [dpdk-users] How to use .last and .spec fields in the Generi= c > Flow API? >=20 > Hi Andrew, >=20 > You are specifying a mask and the last for the item. > Based on the mask that you specified it means that match only the > udp_dst_port that was specified since the mask is 0xffff Which is causing > conflicts with the range. > Try it without setting the mask or set the mask to be 0x0 >=20 > Kindest regards, > Raslan Darawsheh >=20 > > -----Original Message----- > > From: users On Behalf Of Andrew Bainbridge > > Sent: Wednesday, March 6, 2019 5:30 PM > > To: users > > Subject: [dpdk-users] How to use .last and .spec fields in the Generic > > Flow API? > > > > Hi > > > > How should I specify a range of UDP ports in the generic flow API? > > Here's what I've tried... > > > > I'm trying to create a flow to move packets with UDP dest ports from > > 1234 to > > 1244 into a specified queue. It works fine if I specify a single port > > of 1234, instead of the range. Here's how I set the flow item for that: > > > > struct rte_flow_item_udp udp_spec =3D { 0 }; > > struct rte_flow_item_udp udp_mask =3D { 0 }; > > udp_spec.hdr.dst_port =3D htons(udp_dst_port); > > udp_mask.hdr.dst_port =3D 0xffff; > > pattern[2].type =3D RTE_FLOW_ITEM_TYPE_UDP; > > pattern[2].spec =3D &udp_spec; > > pattern[2].mask =3D &udp_mask; > > > > But if I attempt to specify the range, I believe I have to use the .las= t field. > > When I do that, I get this error, 'range between "spec" and "last" is > > larger than "mask"'. Here's how I set that flow item: > > > > struct rte_flow_item_udp udp_spec =3D { 0 }; > > struct rte_flow_item_udp udp_last =3D { 0 }; > > struct rte_flow_item_udp udp_mask =3D { 0 }; > > udp_spec.hdr.dst_port =3D htons(1234); > > udp_last.hdr.dst_port =3D htons(1244); > > udp_mask.hdr.dst_port =3D 0xffff; > > pattern[2].type =3D RTE_FLOW_ITEM_TYPE_UDP; > > pattern[2].spec =3D &udp_spec; > > pattern[2].last =3D &udp_last; > > pattern[2].mask =3D &udp_mask; > > > > I don't understand the error message. The range between spec and last i= s > 10. > > The mask is 0xffff. The error message seems wrong. But probably I just > > misunderstood something. > > > > More details: > > > > I'm using the mlx4 PMD. The source of the error message is in > > mlx4_flow_item_check(), where the code appears goes through each byte > > of the spec and last and checks that: > > > > (((const uint8_t *)item->spec)[i] & mask[i]) !=3D (((const uint8_t > > *)item- > > >last)[i] & mask[i])) > > > > Which makes no sense to me. That appears to require that spec and last > > are equal wherever mask is not zero. > > > > Any ideas? > > > > Thanks, > > Andy