From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0072.outbound.protection.outlook.com [104.47.2.72]) by dpdk.org (Postfix) with ESMTP id 26EDB5B32 for ; Tue, 23 Oct 2018 17:25:18 +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=JZ0eQm/04tbI9vfsquoCUjWCEGpsu1nOqmkdu2nKITI=; b=ATSCG1nJtsAJwwK62kdIwWTJaaj+P9IGyxsQ0ITd4sI35YGijY29H26sOpTJjn34Cmo5yZQTcHXspEgJUwGUwakCGbY/SoXPQjCV4bhS87qnJyyzDLJLo/8PXvgOzT7sIB2+ha5sK2uNjhLMksN9xmB6WH+KHt5C4YRY6z54ILI= Received: from AM4PR05MB3425.eurprd05.prod.outlook.com (10.171.187.142) by AM4PR05MB3361.eurprd05.prod.outlook.com (10.171.187.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1250.30; Tue, 23 Oct 2018 15:25:15 +0000 Received: from AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::fdeb:3890:f0f0:2202]) by AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::fdeb:3890:f0f0:2202%4]) with mapi id 15.20.1228.035; Tue, 23 Oct 2018 15:25:15 +0000 From: Ori Kam To: Shahaf Shuler , Yongseok Koh CC: "dev@dpdk.org" Thread-Topic: [PATCH 4/5] net/mlx5: fix wildcard item for Direct Verbs Thread-Index: AQHUZb45lXFzneXlG0+V2uSfAaQV3qUsfGYAgABKMLA= Date: Tue, 23 Oct 2018 15:25:15 +0000 Message-ID: References: <20181017020739.11203-1-yskoh@mellanox.com> <20181017020739.11203-4-yskoh@mellanox.com> 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=orika@mellanox.com; x-originating-ip: [37.122.157.213] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR05MB3361; 6:xbV/GQpKPzJazH8IoEGvZysX6MXPMJGSlSNU6IJMi0UmL80oAZ/R5GDTkVZ4YZJiXrfMcwJIaTEOblG2XCJGn1sLLURqurM2v9GjZUBPknIeQWnWrwX2yzvo3kByJ+np/rhy6xM/xx3Px8MFDcDPL9Ts05PelNremmf0A+wRKzIXEcJANQJrZpt/k03U8ebEHm52rQwhHicq1ksP1xHo6l+jx08jyLnZ2Hq1cB+0b24re5jwQkixHOJ1h4hbD91Sp8bk+x0NiH89pa9Y/kkIu6mpnHJyeoBnNqxI9MTloyynvcFGkZructXGCR6I2ljCqKmo0JyXmPNj/wdBT8xBI0Q/vNCAQVl1DV9IMKO4H7AHb++lbdLUKEhMDgXVp5cpIOPT2tJWo/Fu7fAkTTzMuWjhw8T9gD97bveP43wKM2a5obMUq79RMjdd89ehya+TgIUN4ylF6VPV+UIHLGrNaQ==; 5:yLsC3DF49YNTeCVzKvANwnur0+We10alWjrLrtrb62ITxGnvWuZiIbbrM0jSgeZwuKp3LVg56YRfYJ8htEgOU8MDuAzhF0tDIix8VCYLhkQDq6BlBPnxtCapVboCyAatjrI9raDC/+gnybnWdj9+/WgKI1OF/Wga4sKtvZoOqVk=; 7:ZISaYTOTMFcZbbBMDTBHmq8MDK/QeRimmhgRfv0Q4cIMl76Lsk1c2v2ef9s9JEH/ZsrlXZzK/w/2m1X8zNYZGogFEcY7fc8Yr2zn8lsjR+/g1YGT9ic6npQDzHsyFqfgQcN7StoQkS9DU4VznJOhlzjjHIodQq/Dg+x8GNforiW11qFauHtZ6qU1nGUTaFc8qSDL3e8xobmj8nRg/MSVAX4ABhAVCo7hqNNN9BGKcUuuG2IrCaJJ+50w71g0c8xD x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 84419097-a75f-4bb5-237d-08d638fbbb9a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM4PR05MB3361; x-ms-traffictypediagnostic: AM4PR05MB3361: 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)(3231355)(944501410)(52105095)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:AM4PR05MB3361; BCL:0; PCL:0; RULEID:; SRVR:AM4PR05MB3361; x-forefront-prvs: 0834BAF534 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(39860400002)(366004)(376002)(136003)(396003)(189003)(199004)(13464003)(53546011)(2900100001)(7736002)(86362001)(9686003)(6636002)(305945005)(105586002)(106356001)(6506007)(478600001)(7696005)(6246003)(53936002)(74316002)(229853002)(71200400001)(316002)(71190400001)(25786009)(26005)(66066001)(76176011)(110136005)(8936002)(99286004)(476003)(6436002)(11346002)(33656002)(5660300001)(14454004)(4326008)(486006)(102836004)(2906002)(3846002)(8676002)(81166006)(5250100002)(68736007)(55016002)(97736004)(81156014)(256004)(6116002)(186003)(446003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3361; H:AM4PR05MB3425.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-microsoft-antispam-message-info: ybHTQnbzJqG0gDNcNxBeL2TFUmwjhs2YQFU7V9XJWDPRZvSh0GWxmByXHIpoK24up+MACKFBDmBq7ZrcxUcaA7eoFIfGVcVV/WYsfpJpT1raEu7rMA00Angiyp7svIc/4+aBmeXQ4OM31aD4brax91UyURmMFOK2cPJCLrAh/moab1keVjCLokdm3Rah3w28C9HtHcPYkjAU3Y+qStlxROT4VmEMSKPXbmLe5O1WMHGkJDZ1Y19FY5o7/LPLhAwFHqGtJnkvFbHUbLdME7NUgJx/yo4ib7xFaY8mWKWBVgqvM3SfS+G6vpWwQBwGlDoWZ8JaWQeGnMhIjM2Xp/9Pvsc3Pqugyct+y600V6fRNBk= 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: 84419097-a75f-4bb5-237d-08d638fbbb9a X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Oct 2018 15:25:15.3440 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3361 Subject: Re: [dpdk-dev] [PATCH 4/5] net/mlx5: fix wildcard item for Direct Verbs 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: Tue, 23 Oct 2018 15:25:18 -0000 PSB > -----Original Message----- > From: Shahaf Shuler > Sent: Tuesday, October 23, 2018 10:42 AM > To: Yongseok Koh > Cc: dev@dpdk.org; Ori Kam > Subject: RE: [PATCH 4/5] net/mlx5: fix wildcard item for Direct Verbs >=20 > Wednesday, October 17, 2018 5:08 AM, Yongseok Koh: > > Subject: [PATCH 4/5] net/mlx5: fix wildcard item for Direct Verbs > > > > If a network layer is specified with no spec, it means wildcard match. > > flow_dv_translate_item_*() returns without writing anything if spec is = null > > and it causes creation of wrong flow. E.g., the following flow has to p= atch > > with any ipv4 packet. > > > > flow create 0 ingress pattern eth / ipv4 / end actions ... > > > > But, with the current code, it matches any packet because PMD doesn't w= rite > > anything about IPv4. The matcher value and mask becomes completely zero= . > > It should have written the IP version at least. It is same for the rest= of items. > > > > Even if the spec is null, PMD has to write constant fields before retur= n, e.g. IP > > version and IP protocol number. > > > > Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items") > > Cc: orika@mellanox.com > > > > Signed-off-by: Yongseok Koh > > Acked-by: Ori Kam >=20 > [...] >=20 > > #include > > #include > > #include > > @@ -474,10 +473,6 @@ flow_dv_translate_item_ipv4(void *matcher, void > > *key, > > char *l24_v; > > uint8_t tos; > > > > - if (!ipv4_v) > > - return; > > - if (!ipv4_m) > > - ipv4_m =3D &nic_mask; > > if (inner) { > > headers_m =3D MLX5_ADDR_OF(fte_match_param, matcher, > > inner_headers); > > @@ -489,6 +484,10 @@ flow_dv_translate_item_ipv4(void *matcher, void > > *key, > > } > > MLX5_SET(fte_match_set_lyr_2_4, headers_m, ip_version, 0xf); > > MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_version, 4); >=20 > Is matching on the ip version is enough? Don't we need to match also the > ethertype? > Meaning maybe the value on the IP offset can be 4 even though it is not a= IPv4 > header. >=20 > Same question for IPv6. I think you are correct,=20 We should also test the ethertype. >=20 > > + if (!ipv4_v) > > + return; > > + if (!ipv4_m) > > + ipv4_m =3D &nic_mask; > > l24_m =3D MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_m, > > dst_ipv4_dst_ipv6.ipv4_layout.ipv4); > > l24_v =3D MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_v, @@ - > > 557,10 +556,6 @@ flow_dv_translate_item_ipv6(void *matcher, void *key, > > int i; > > int size; > > > > - if (!ipv6_v) > > - return; > > - if (!ipv6_m) > > - ipv6_m =3D &nic_mask; > > if (inner) { > > headers_m =3D MLX5_ADDR_OF(fte_match_param, matcher, > > inner_headers); > > @@ -570,6 +565,12 @@ flow_dv_translate_item_ipv6(void *matcher, void > > *key, > > outer_headers); > > headers_v =3D MLX5_ADDR_OF(fte_match_param, key, > > outer_headers); > > } > > + MLX5_SET(fte_match_set_lyr_2_4, headers_m, ip_version, 0xf); > > + MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_version, 6); > > + if (!ipv6_v) > > + return; > > + if (!ipv6_m) > > + ipv6_m =3D &nic_mask; > > size =3D sizeof(ipv6_m->hdr.dst_addr); > > l24_m =3D MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_m, > > dst_ipv4_dst_ipv6.ipv6_layout.ipv6); > > @@ -585,8 +586,6 @@ flow_dv_translate_item_ipv6(void *matcher, void > > *key, > > memcpy(l24_m, ipv6_m->hdr.src_addr, size); > > for (i =3D 0; i < size; ++i) > > l24_v[i] =3D l24_m[i] & ipv6_v->hdr.src_addr[i]; > > - MLX5_SET(fte_match_set_lyr_2_4, headers_m, ip_version, 0xf); > > - MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_version, 6); > > /* TOS. */ > > vtc_m =3D rte_be_to_cpu_32(ipv6_m->hdr.vtc_flow); > > vtc_v =3D rte_be_to_cpu_32(ipv6_m->hdr.vtc_flow & ipv6_v- > > >hdr.vtc_flow); @@ -635,10 +634,6 @@ flow_dv_translate_item_tcp(void > > *matcher, void *key, > > void *headers_m; > > void *headers_v; > > > > - if (!tcp_v) > > - return; > > - if (!tcp_m) > > - tcp_m =3D &rte_flow_item_tcp_mask; > > if (inner) { > > headers_m =3D MLX5_ADDR_OF(fte_match_param, matcher, > > inner_headers); > > @@ -650,6 +645,10 @@ flow_dv_translate_item_tcp(void *matcher, void > > *key, > > } > > MLX5_SET(fte_match_set_lyr_2_4, headers_m, ip_protocol, 0xff); > > MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol, > > IPPROTO_TCP); > > + if (!tcp_v) > > + return; > > + if (!tcp_m) > > + tcp_m =3D &rte_flow_item_tcp_mask; > > MLX5_SET(fte_match_set_lyr_2_4, headers_m, tcp_sport, > > rte_be_to_cpu_16(tcp_m->hdr.src_port)); > > MLX5_SET(fte_match_set_lyr_2_4, headers_v, tcp_sport, @@ - > > 682,10 +681,6 @@ flow_dv_translate_item_udp(void *matcher, void *key, > > void *headers_m; > > void *headers_v; > > > > - if (!udp_v) > > - return; > > - if (!udp_m) > > - udp_m =3D &rte_flow_item_udp_mask; > > if (inner) { > > headers_m =3D MLX5_ADDR_OF(fte_match_param, matcher, > > inner_headers); > > @@ -697,6 +692,10 @@ flow_dv_translate_item_udp(void *matcher, void > > *key, > > } > > MLX5_SET(fte_match_set_lyr_2_4, headers_m, ip_protocol, 0xff); > > MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol, > > IPPROTO_UDP); > > + if (!udp_v) > > + return; > > + if (!udp_m) > > + udp_m =3D &rte_flow_item_udp_mask; > > MLX5_SET(fte_match_set_lyr_2_4, headers_m, udp_sport, > > rte_be_to_cpu_16(udp_m->hdr.src_port)); > > MLX5_SET(fte_match_set_lyr_2_4, headers_v, udp_sport, @@ - > > 731,10 +730,6 @@ flow_dv_translate_item_gre(void *matcher, void *key, > > void *misc_m =3D MLX5_ADDR_OF(fte_match_param, matcher, > > misc_parameters); > > void *misc_v =3D MLX5_ADDR_OF(fte_match_param, key, > > misc_parameters); > > > > - if (!gre_v) > > - return; > > - if (!gre_m) > > - gre_m =3D &rte_flow_item_gre_mask; > > if (inner) { > > headers_m =3D MLX5_ADDR_OF(fte_match_param, matcher, > > inner_headers); > > @@ -746,6 +741,10 @@ flow_dv_translate_item_gre(void *matcher, void > > *key, > > } > > MLX5_SET(fte_match_set_lyr_2_4, headers_m, ip_protocol, 0xff); > > MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol, > > IPPROTO_GRE); > > + if (!gre_v) > > + return; > > + if (!gre_m) > > + gre_m =3D &rte_flow_item_gre_mask; > > MLX5_SET(fte_match_set_misc, misc_m, gre_protocol, > > rte_be_to_cpu_16(gre_m->protocol)); > > MLX5_SET(fte_match_set_misc, misc_v, gre_protocol, @@ -780,6 > > +779,7 @@ flow_dv_translate_item_nvgre(void *matcher, void *key, > > int size; > > int i; > > > > + flow_dv_translate_item_gre(matcher, key, item, inner); > > if (!nvgre_v) > > return; > > if (!nvgre_m) > > @@ -790,7 +790,6 @@ flow_dv_translate_item_nvgre(void *matcher, void > > *key, > > memcpy(gre_key_m, tni_flow_id_m, size); > > for (i =3D 0; i < size; ++i) > > gre_key_v[i] =3D gre_key_m[i] & tni_flow_id_v[i]; > > - flow_dv_translate_item_gre(matcher, key, item, inner); > > } > > > > /** > > @@ -822,10 +821,6 @@ flow_dv_translate_item_vxlan(void *matcher, void > > *key, > > int size; > > int i; > > > > - if (!vxlan_v) > > - return; > > - if (!vxlan_m) > > - vxlan_m =3D &rte_flow_item_vxlan_mask; > > if (inner) { > > headers_m =3D MLX5_ADDR_OF(fte_match_param, matcher, > > inner_headers); > > @@ -841,6 +836,10 @@ flow_dv_translate_item_vxlan(void *matcher, void > > *key, > > MLX5_SET(fte_match_set_lyr_2_4, headers_m, udp_dport, > > 0xFFFF); > > MLX5_SET(fte_match_set_lyr_2_4, headers_v, udp_dport, > > dport); > > } > > + if (!vxlan_v) > > + return; > > + if (!vxlan_m) > > + vxlan_m =3D &rte_flow_item_vxlan_mask; > > size =3D sizeof(vxlan_m->vni); > > vni_m =3D MLX5_ADDR_OF(fte_match_set_misc, misc_m, vxlan_vni); > > vni_v =3D MLX5_ADDR_OF(fte_match_set_misc, misc_v, vxlan_vni); > > -- > > 2.11.0