From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0046.outbound.protection.outlook.com [104.47.2.46]) by dpdk.org (Postfix) with ESMTP id 965BF2C8; Wed, 23 May 2018 13:45:35 +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=C3DRNB1j2WlwVPReE3i5vBLGl6Oit85O+vZlZjVQSz4=; b=WJYrPZ4+57TE4I4AM4KaJq9POM7kLKrMgOVS7Y2mAuZu5ztSZlh/2RHF/PM6DHTDoL8kQ/qTrYgTVQmv3ldtePEfFDVpQSBrTgWFto9VS4BrOyCPaljt9ZhzSMGzLEhl3+eoU/3lbhkeUhjcgYsQpmGEdxuZ5juh6+nslsLqKfg= Received: from VI1PR0501MB2608.eurprd05.prod.outlook.com (10.168.137.20) by VI1PR0501MB2190.eurprd05.prod.outlook.com (10.169.134.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Wed, 23 May 2018 11:45:34 +0000 Received: from VI1PR0501MB2608.eurprd05.prod.outlook.com ([fe80::1035:58f9:b94c:2180]) by VI1PR0501MB2608.eurprd05.prod.outlook.com ([fe80::1035:58f9:b94c:2180%18]) with mapi id 15.20.0776.015; Wed, 23 May 2018 11:45:33 +0000 From: Matan Azrad To: Yongseok Koh CC: Shahaf Shuler , Adrien Mazarguil , =?iso-8859-1?Q?N=E9lio_Laranjeiro?= , "dev@dpdk.org" , "stable@dpdk.org" , "Xueming(Steven) Li" Thread-Topic: [dpdk-dev] [PATCH] net/mlx5: fix GRE flow rule Thread-Index: AQHT8ji4UdW7+yaJAE27AdV43Ftbk6Q8wtFAgABSvgCAAARNsA== Date: Wed, 23 May 2018 11:45:33 +0000 Message-ID: References: <20180523015157.35716-1-yskoh@mellanox.com> <20180523100116.GA11530@minint-98vp2qg> In-Reply-To: <20180523100116.GA11530@minint-98vp2qg> 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; VI1PR0501MB2190; 7:OcWVmwitPLXgBP6MYZ0yrVXgHUNpzVmbRNJH3+3kquQ5bauDUSRznSBlHuuM+f6W8UBV0sLkovaCOirUdo+1txTCZjLAWcGjC24u4nVlB0u/F5X2rhluIf+WUFv64TJjdb1QARKvbA+2lU+0GQtE+iuomTifGKyR6p0vptCM4FNhr73+Bnn9Y+mFLZwAzrs6j17dFgPQKYBQCrg/Rq2E+WqehBm/YVUB9tf2Cs8rIbtOF4G1/XZs935xeRjObYMe x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:VI1PR0501MB2190; x-ms-traffictypediagnostic: VI1PR0501MB2190: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:VI1PR0501MB2190; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2190; x-forefront-prvs: 06818431B9 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(39380400002)(366004)(396003)(376002)(346002)(199004)(189003)(51444003)(8936002)(102836004)(14454004)(97736004)(106356001)(54906003)(81156014)(316002)(81166006)(105586002)(8676002)(3660700001)(3280700002)(305945005)(2906002)(7736002)(2900100001)(25786009)(6636002)(6246003)(66066001)(53936002)(478600001)(107886003)(55016002)(4326008)(9686003)(68736007)(6862004)(6436002)(229853002)(33656002)(74316002)(86362001)(575784001)(99286004)(26005)(6506007)(76176011)(476003)(5660300001)(486006)(5250100002)(11346002)(3846002)(7696005)(6116002)(446003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2190; H:VI1PR0501MB2608.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: 6I2JoZ2x7O2JD1nLYxat8WkxFYdMzjG4rZbw2zK0mt51znS+n8AvVxxnVnpugNIgQd9Bfb1+ZmH6c/28/Yuvs5jB1F4gagXb2sMefOFMq/ryaucuNbJx80sE1/uC/Vq7KeHl3LBqFNgYAbRVxyGcqOrGspCL7sNfoUAnv6YPIKgHBqUiCDYEcu1dvVURVM8d spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 5e1c1bc7-a3b4-41b7-9647-08d5c0a2b18c X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e1c1bc7-a3b4-41b7-9647-08d5c0a2b18c X-MS-Exchange-CrossTenant-originalarrivaltime: 23 May 2018 11:45:33.8027 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2190 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix GRE flow rule 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: Wed, 23 May 2018 11:45:35 -0000 Hi Yongseok + Steven=20 From: Yongseok Koh > On Tue, May 22, 2018 at 10:36:43PM -0700, Matan Azrad wrote: > > Hi Yongseok > > > > From: Yongseok Koh > > > Creating a flow having pattern from the middle of a packet is > > > allowed. For example, > > > > > > testpmd> flow create 0 ingress pattern vxlan vni is 20 / end action= s ... > > > > > > Device can parse GRE header but without proper support from library > > > and firmware (HAVE_IBV_DEVICE_MPLS_SUPPORT), a field in GRE header > > > can't be specified when creating a rule. As a result, the following > > > rule will be interpreted as a wildcard rule, which always matches any > packet. > > > > > > testpmd> flow create 0 ingress pattern gre / end actions ... > > > Fixes: 96c6c65a10d2 ("net/mlx5: support GRE tunnel flow") > > > Fixes: 1f106da2bf7b ("net/mlx5: support MPLS-in-GRE and > > > MPLS-in-UDP") > > > Cc: stable@dpdk.org > > > > > > Signed-off-by: Yongseok Koh > > > --- > > > drivers/net/mlx5/mlx5_flow.c | 6 ++++-- > > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/net/mlx5/mlx5_flow.c > > > b/drivers/net/mlx5/mlx5_flow.c index 994be05be..526fe6b0e 100644 > > > --- a/drivers/net/mlx5/mlx5_flow.c > > > +++ b/drivers/net/mlx5/mlx5_flow.c > > > @@ -330,9 +330,11 @@ static const enum rte_flow_action_type > > > valid_actions[] =3D { static const struct mlx5_flow_items mlx5_flow_= items[] =3D > { > > > [RTE_FLOW_ITEM_TYPE_END] =3D { > > > .items =3D ITEMS(RTE_FLOW_ITEM_TYPE_ETH, > > > +#ifdef HAVE_IBV_DEVICE_MPLS_SUPPORT > > > > The GRE item was here even before the MPLSoGRE support >=20 > Yes, this bug has existed before adding MPLSoGRE support. >=20 > > so I think that this is not the correct fix and even that it can hurt > > the support of GRE for the current customers use it. >=20 > How can it hurt? Please clarify. Someone who uses the next flow and have not the new verbs version of MPLS: flow create 0 ingress pattern gre / ipv4 src is X / end actions ... ipv4 src or any other inner specifications. This flow will probably get any supported tunnel packets with inner ipv4 sr= c =3D X. It may be enough for the current user (which probably use only 1 tunnel typ= e at a certain time). > > Looks like you must specify at least 1 spec in the GRE to apply it > > correctly as you did for VXLAN, Can you try empty vxlan and fully gre > > (with protocol field)? >=20 > That's exactly the reason why I'm taking this out. If you look at the cod= e, it > doesn't even set any field for GRE if HAVE_IBV_DEVICE_MPLS_SUPPORT isn't > supported. Thus, it is considered as a wildcard (all-matching) rule. But = if it has > HAVE_IBV_DEVICE_MPLS_SUPPORT, such pattern can be allowed. Yes, so your GRE flow will not work even if you have MPLS support. I think the issue is generally in all the items: You should not configure them if they miss both at least one self-specifica= tion or item which points to them by "next protocol" field. In case of VXLAN tunnels we just don't allow them without self-specificatio= n, In case of gre we force the next protocol of the previous item but only whe= n it exists. In case of eth(inner),vlan,ipv4,ipv6,udp,tcp we don't force anything. =20 I think we need a global fix for all, this is probably the root cause. >=20 > Having pattern 'vxlan' without vni isn't allowed by mlx5 PMD because zero= VNI > is never accepted. >=20 > Thanks, > Yongseok >=20 > > > + RTE_FLOW_ITEM_TYPE_GRE, > > > +#endif > > > RTE_FLOW_ITEM_TYPE_VXLAN, > > > - RTE_FLOW_ITEM_TYPE_VXLAN_GPE, > > > - RTE_FLOW_ITEM_TYPE_GRE), > > > + RTE_FLOW_ITEM_TYPE_VXLAN_GPE), > > > }, > > > [RTE_FLOW_ITEM_TYPE_ETH] =3D { > > > .items =3D ITEMS(RTE_FLOW_ITEM_TYPE_VLAN, > > > > > >