From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00061.outbound.protection.outlook.com [40.107.0.61]) by dpdk.org (Postfix) with ESMTP id EEF181B46E; Mon, 6 Aug 2018 11:58:56 +0200 (CEST) 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=uQsI5dYkzDQGgi0B0hXpg067J6xuSNrt+vj8zhdr1+E=; b=eCxj+mH87am0BHisx9cHT3lSmalsK03LhYFSrheNW4IZPHgw2wOvij004hMhA89ML2EQ3pOBkXRf+0p9GfQHfR54ALUEzTH8QRvp9+wemnN/8eok7cvZIvq13cLxYDMYY9zYMoHREiTh+5xmqHxlxQI+Na8dVtRdBM1xB4gwAzo= Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com (52.133.41.11) by AM0PR0502MB3716.eurprd05.prod.outlook.com (52.133.46.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Mon, 6 Aug 2018 09:58:55 +0000 Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com ([fe80::9d98:d47f:5b50:1f49]) by AM0PR0502MB4019.eurprd05.prod.outlook.com ([fe80::9d98:d47f:5b50:1f49%2]) with mapi id 15.20.1017.019; Mon, 6 Aug 2018 09:58:55 +0000 From: Matan Azrad To: Adrien Mazarguil CC: Keith Wiles , Ophir Munk , "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] net/tap: fix zeroed flow mask configurations Thread-Index: AQHUKkxANy4bvWK4qUyNwHKWN0YqIaSshVOAgAA3A8CAAPTYgIAC/gDwgAHPW4CAAASbcA== Date: Mon, 6 Aug 2018 09:58:55 +0000 Message-ID: References: <1533205980-7874-1-git-send-email-matan@mellanox.com> <20180802142737.GO5211@6wind.com> <20180803082051.GP5211@6wind.com> <20180806094053.GS5211@6wind.com> In-Reply-To: <20180806094053.GS5211@6wind.com> Accept-Language: en-US, he-IL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR0502MB3716; 6:N08gJwYS9DZJc2GNVMQBFwMUVMHEWeEDZc9vuc9idiWjqFT/aNN+Rky8uCXpSTqq4g01rmkIqKIA6fi2JDX0xnKGwymKaCLT4nprOMlnh6y/e5lPTVd1yD0nt3AkbeArOeMXhW7woqAGr0yKCOUEu08wa+b/g/n3yYiRlWGaps7uC02tgpeVj7W1aTlsAWZPOcz3NBJzmC6aIZ5TUbhqo/wfms0fNAcLwcdmoPk4uLmS5yebT+mMRB2dP2toez+YlgyLpAE5CVxrVnYcx8M8mc/6CTZkGrXYouOnFfu/5RN1G3TebFK5u6DGyN1BhIpPyz7ETTn6XC/2B1ynWXypXNXLTqRuET24ccNdaSOTrMx59c24FS9bzKyA/dIyS9ltS/lhwazFRmAw5ga1Jy21xSn+4jBe5G1wiUXvO4EFTY1ep8PHl2mYIGl4ycDmue/qoNiLlIjVmKu+YMhx/gVa5g==; 5:/8drMyKEB5oAN4cIG5ZWGioyIvV3NHNazmb6/JjUikIDOYHwWO2iJePSY7pptUcHZqw5kXIkM1y8J83rnUOqqqVrPVga300mPfQ9hpXjLrLJIfxcn7db2a6JjDs9wxxfeHg5Rcj5vejvfp75oi6WHuAG0+AiSF84Hjjo7k4libE=; 7:vbydjBEoz2c5VP1t3B4VGD3bKp7/71uyQyKdBKEUbFajfckeviUrZ3zlnxq/VfQD2ZdVC6cRn9loj6uk04EQBMDs00o8fLPdGNHoXD4Yc1djUByD4RKPCVHBU05Dg9aK2vNKpggGQFq+9zNtk2kczq2zTE0lzz+cQOKRrfCPEsxNQ7mmCkMJyv/k0tUcksqmZxyk/3SghhUaNl7l2G7I87zF2S/7Qju9H2pjfj2UjCvpNx2Ej0cEly1MR/RAFR+u x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 0b757070-994c-4053-8ddc-08d5fb8338cd x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR0502MB3716; x-ms-traffictypediagnostic: AM0PR0502MB3716: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(200054503718035); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231311)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123560045)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:AM0PR0502MB3716; BCL:0; PCL:0; RULEID:; SRVR:AM0PR0502MB3716; x-forefront-prvs: 07562C22DA x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(366004)(396003)(39860400002)(376002)(136003)(199004)(189003)(7736002)(305945005)(105586002)(106356001)(66066001)(25786009)(54906003)(99286004)(316002)(74316002)(446003)(14444005)(11346002)(86362001)(97736004)(5250100002)(8676002)(478600001)(14454004)(6116002)(3846002)(2900100001)(256004)(76176011)(9686003)(26005)(8936002)(229853002)(68736007)(2906002)(486006)(6436002)(33656002)(55016002)(476003)(6916009)(5660300001)(81156014)(81166006)(93886005)(6246003)(7696005)(186003)(53936002)(6506007)(4326008)(102836004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3716; H:AM0PR0502MB4019.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-microsoft-antispam-message-info: JXuH5kejiPXKbhd7xKfknZCpr3jW4hhJlhu1puSCoT+X5/JZ7ZgqmDumGJChGse40DnE3bgMPXUafYnkQ5daOr1jtFuslW135oZB+2tHo+fR6ISTujqBX2DBMu69tZXIPNCzFg/nQJ/R8Su5il6d0TgLQ1wDy1ChASv+snY4rKaCnMc4tmnZW9+yI2ZdQAUmA/eFZ/IcUL9nQzoGcMq8ab8t3r2cyVw6feE0OBcXeyGtEk6J633az9qaEC+CnL2sIIIl24Nx7NhoopYAoBlK2CXjLNyPSr0X9yp8W/BZx3lxyPOnJrgm92AynDAZ3JwqQuSh25bSkKebjpwCMXXcnDX2bOGkjZOdQxIp1X3EzvA= 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: 0b757070-994c-4053-8ddc-08d5fb8338cd X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Aug 2018 09:58:55.3584 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3716 Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] net/tap: fix zeroed flow mask configurations X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2018 09:58:57 -0000 Hi Adrien From: Adrien Mazarguil > On Sun, Aug 05, 2018 at 06:10:55AM +0000, Matan Azrad wrote: > > Hi Adrien > > > > From: Adrien Mazarguil > > > Hi Matan, > > > > > > On Thu, Aug 02, 2018 at 05:52:18PM +0000, Matan Azrad wrote: > > > > Hi Adrien > > > > > > > > From: Adrien Mazarguil > > > > > On Thu, Aug 02, 2018 at 10:33:00AM +0000, Matan Azrad wrote: > > > > > > The rte_flow meaning of zero flow mask configuration is to > > > > > > match all the range of the item value. > > > > > > For example, the flow eth / ipv4 dst spec 1.2.3.4 dst mask > > > > > > 0.0.0.0 should much all the ipv4 traffic from the rte_flow API > perspective. > > > > > > > > > > > > From some kernel perspectives the above rule means to ignore > > > > > > all the > > > > > > ipv4 traffic (e.g. Ubuntu 16.04, 4.15.10). > > > > > > > > > > > > Due to the fact that the tap PMD should provide the rte_flow > > > > > > meaning, it is necessary to ignore the spec in case the mask > > > > > > is zero when it forwards such like flows to the kernel. > > > > > > So, the above rule should be translated to eth / ipv4 to get > > > > > > the correct meaning. > > > > > > > > > > > > Ignore spec configurations when the mask is zero. > > > > > > > > > > I would go further, one should be able to match IP address > > > > > 0.0.0.0 for > > > instance. > > > > > The PMD should only trust the mask on all fields without looking = at > spec. > > > > > > > > The PMD should convert the RTE flow API to the device > > > > configuration, So I can think on scenarios that the PMD should look= on > spec. > > > > > > Obviously the PMD needs to take spec into account. What I meant is > > > that for each field, spec must be taken into account according to mas= k > only. > > > > > > For any given field, when mask is empty, don't look at spec, it's lik= e a > wildcard. > > > When mask is full, take spec as is, even if spec only contains zeroed= bits. > > > > > > User intent in that case is to match a zero value exactly, so it > > > must not result in a wildcard match. If supported, when mask is > > > partial, masked bits are also matched exactly, even if these turn > > > out to be a zero value. Unmasked bits are considered wildcards. > > > > > > > Yes I understand your point Adrien, but I mean that maybe sometimes > some spec values should be converted to another spec values to get the > correct translation of rte_flow for a special device. > > > > Here, maybe IP_spec=3D0.0.0.0 is a special case that should be taken in= to > account, so we must validate what's happen in Tap for this case to apply = your > suggestion too, Maybe there was some intentions for spec=3D0 cases from t= he > current code author. >=20 > I understand that's a lot of maybes :) >=20 > I've checked the code and I'am sure it's a mistake made by the original > author. See tap_flow_create_eth() for instance: >=20 > if (!is_zero_ether_addr(&spec->dst)) { >=20 > Followed by: >=20 > if (!is_zero_ether_addr(&mask->src)) >=20 > This lack of consistency doesn't make any sense, it cannot be on purpose. >=20 > To my credentials I wrote a very similar code which uses TC flower in mlx= 5 > and relies on mask (only) in order to retrieve spec. Have a look at > drivers/net/mlx5/mlx5_nl_flow.c. I validated that traffic where addresses > were all zeroes could be successfully matched. > I will check the spec zero cases and will update. Thanks Adrien! =20