From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130100.outbound.protection.outlook.com [40.107.13.100]) by dpdk.org (Postfix) with ESMTP id 5D0CB2C39 for ; Thu, 7 Mar 2019 12:10:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UnAiVkBQjbCN2Y/19rKsDrd29OLNahw0Np0uge7cz9k=; b=iokni9sYhAZw3TnkXuQKl+w1fPC0XVgjDadoWpyWUPVONCPIrMv4qqYWe4DYyzH7jQ2qm0A1cGqUqjcsdixa6hl39Vo6s1BI3dwoDn0dYrTKBTrIjM2uAL9jcoadBmT7C6UlTPEtas5vArnI0/4mQUOpObmUjV/G4/3W7WNdyyY= Received: from DB7PR83MB0235.EURPRD83.prod.outlook.com (20.176.228.150) by DB7PR83MB0236.EURPRD83.prod.outlook.com (20.176.228.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.1; Thu, 7 Mar 2019 11:10:28 +0000 Received: from DB7PR83MB0235.EURPRD83.prod.outlook.com ([fe80::e5a4:9c7f:7b70:302b]) by DB7PR83MB0235.EURPRD83.prod.outlook.com ([fe80::e5a4:9c7f:7b70:302b%6]) with mapi id 15.20.1709.009; Thu, 7 Mar 2019 11:10:28 +0000 From: Andrew Bainbridge To: Raslan Darawsheh , users Thread-Topic: [dpdk-users] How to use .last and .spec fields in the Generic Flow API? Thread-Index: AQHU1MMA8geO+nRyfU6NMmuXGe+bC6X/9BTg Date: Thu, 7 Mar 2019 11:10:27 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=andbain@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2019-03-07T11:10:25.8167126Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=70b6120b-c913-4ed9-9d27-58111ca845d7; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic x-originating-ip: [2a01:110:8012:1012:48ca:85a4:b745:a1cb] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ee3823eb-db93-43fb-6e83-08d6a2ed8154 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)(7193020); SRVR:DB7PR83MB0236; x-ms-traffictypediagnostic: DB7PR83MB0236: x-ms-exchange-purlcount: 1 x-o365-sonar-daas-pilot: True x-microsoft-antispam-prvs: x-forefront-prvs: 096943F07A x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(136003)(396003)(346002)(39860400002)(366004)(13464003)(51914003)(199004)(189003)(97736004)(7696005)(8990500004)(99286004)(186003)(486006)(110136005)(476003)(68736007)(11346002)(105586002)(52536013)(478600001)(5660300002)(316002)(22452003)(81156014)(53936002)(305945005)(8936002)(7736002)(102836004)(55016002)(9686003)(71190400001)(71200400001)(10090500001)(6306002)(81166006)(53546011)(6506007)(86362001)(229853002)(6116002)(6346003)(2906002)(46003)(25786009)(76176011)(106356001)(14454004)(74316002)(86612001)(446003)(33656002)(256004)(6436002)(6246003)(10290500003)(41533002)(142923001); DIR:OUT; SFP:1102; SCL:1; SRVR:DB7PR83MB0236; H:DB7PR83MB0235.EURPRD83.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=andbain@microsoft.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: WZalfNo08P5vqAeIGgLuQYuS2yK8iRDm5VgLGImuYmfsvWmb6bQXm0iDRlmSxv5evrZHk9T8gCd9SBh1Lv8HqV9PcMeTbFAD4510JIob8hX+cfGbHBL299ZmVu5m3A+DDzXlr8JaOKSZsC1KXMSmOmJiFZQSdokdn5T6Ac/FKHMvnBMjn8NbA0YEWxqD3MRmQ7PmYjcJo/fm83RqNFK+QlNy1WDXW/CaH6nc7NAJ4dXQq+IBR6LLIPe8gSlvSQIWvWqdCLEsZWfSq0sRtcuvf6EmEpcZefLcOdyxkeGPMGUMRF2/SSvRCc55I8XOTL0LMjpQVrfi4qw/VExW8ftcMyC48TGQqnV4DGv1bHwgUo5pgeq9t0mCsfvQvM2Xt7sMW5sgZ5do0P8qpFlZBoawlND+JKzr0Pl9JAJ4+MJn3YY= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee3823eb-db93-43fb-6e83-08d6a2ed8154 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Mar 2019 11:10:27.7294 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR83MB0236 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:10:29 -0000 Hi Raslan Thanks for the reply. It sounds very sensible. Unfortunately I can't get it= to work. If I do not set the mask, I get the "range between spec and last is larger = than mask" error again. If I set the mask to 0, then all udp dst port numbers are accepted. If I set the mask to 0xff, I get, "mlx4 does not support matching partial U= DP fields". Do any of these work on the PMD you use? The generic flow docs (https://doc= .dpdk.org/guides/prog_guide/rte_flow.html section 9.2.3) say, "mask is a si= mple bit-mask applied before interpreting the contents of spec and last", w= hich sort-of implies I need to set the mask to non-zero even when using "la= st". I can't find any other relevant documentation or example code. Thanks, Andrew -----Original Message----- From: Raslan Darawsheh =20 Sent: 07 March 2019 08:52 To: Andrew Bainbridge ; users Subject: RE: [dpdk-users] How to use .last and .spec fields in the Generic = Flow API? Hi Andrew, 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_p= ort 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 Kindest regards, Raslan Darawsheh > -----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=20 > Flow API? >=20 > Hi >=20 > How should I specify a range of UDP ports in the generic flow API?=20 > Here's what I've tried... >=20 > I'm trying to create a flow to move packets with UDP dest ports from=20 > 1234 to > 1244 into a specified queue. It works fine if I specify a single port=20 > of 1234, instead of the range. Here's how I set the flow item for that: >=20 > 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; >=20 > But if I attempt to specify the range, I believe I have to use the .last = field. > When I do that, I get this error, 'range between "spec" and "last" is=20 > larger than "mask"'. Here's how I set that flow item: >=20 > 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; >=20 > I don't understand the error message. The range between spec and last is = 10. > The mask is 0xffff. The error message seems wrong. But probably I just=20 > misunderstood something. >=20 > More details: >=20 > I'm using the mlx4 PMD. The source of the error message is in=20 > mlx4_flow_item_check(), where the code appears goes through each byte=20 > of the spec and last and checks that: >=20 > (((const uint8_t *)item->spec)[i] & mask[i]) !=3D (((const uint8_t=20 > *)item- > >last)[i] & mask[i])) >=20 > Which makes no sense to me. That appears to require that spec and last=20 > are equal wherever mask is not zero. >=20 > Any ideas? >=20 > Thanks, > Andy