From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E21E3A00E6 for ; Tue, 6 Aug 2019 11:20:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 58E681B945; Tue, 6 Aug 2019 11:20:14 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50061.outbound.protection.outlook.com [40.107.5.61]) by dpdk.org (Postfix) with ESMTP id 6EFFED187 for ; Tue, 6 Aug 2019 11:20:12 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GKz6bEc3K9/IJIK2QnvIVZUQTmx8WO4IQBd8tn76DekAvc+rhMmd5321qMOkHwswdb+nAODo7bdglzNtl+zR8xRbDPn9W+sA/DSCXmLBcEEaRgRatVK96UbOVm7lJWXANaykbbhdT3B47qLnYEB3FFrietf9o6krL9M29IQD+Nmnlfuc2EcYuibHefJuAse7Lv24Wor3fwZU1iqxG/RjMMgWHGqDoQvLmTG/mPrfo6PQ90RC+ksfkn7d9R3PM9L2QapcxhyIOc/16WqBz7jx78T2EkPkPDyvCVvgZmhpBDPtyIpOwrzqZB4ReZCt+IllPU8UsJa1QmTUZcdj8KnHZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0Go5uk5ePVe4bqxBXvM1liUG5akPI938cuCD5ToV78Y=; b=AFmRX5E5SOvCy5QOKIcnRoAF+63+dLO1bnr+ZeaegwZM7c5gRglRK2RyR6agcn4viWV8Fp9kMchLnu3hKO0ZjQhH/lCEbGszvCY9e/wDyvUF+xkX+BbVGJhi7fWRqI0vh2RVXLPTard7AQZY6Vhkt+80+hJbEVA5oe3LFHTD9mA76mkNhtBmYXpggUA7WTtfIcw01NhNv8lqCL0TE971TvmQbVv5uv/ZmO0w9s09yPSiOGT+rKqMs9Qnolokp/beIx4GQBJ/MTYqdfVv/PDs0816rtyOxbq7oJVksooLCKbxx2RUXavmTz/3q/cComaIpFveAHBBEQ4aZmK2XCcV/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0Go5uk5ePVe4bqxBXvM1liUG5akPI938cuCD5ToV78Y=; b=oyQYPJJg88JTfOimrc5TzKCDZuGiTDLbZ1f/edv2WBDaF88iPUJLGV0kYMUVlktE/iQSZKhMpSOMBX2w6RgJ9FkNLPnoKiiaiARcdw3WcylIEbxGZa8pFG3aYIuj8tF3tAl2GUKAamLXprXXp81vHSQgi13bAiiaOW34Fy9Ax5Y= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.188.154) by AM4PR05MB3506.eurprd05.prod.outlook.com (10.171.186.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2157.13; Tue, 6 Aug 2019 09:20:11 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::ec83:c573:8eda:b6a]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::ec83:c573:8eda:b6a%4]) with mapi id 15.20.2136.018; Tue, 6 Aug 2019 09:20:11 +0000 From: Slava Ovsiienko To: Jack Min , Shahaf Shuler , Yongseok Koh CC: "dev@dpdk.org" , Jack Min Thread-Topic: [Suspected-Phishing][PATCH] net/mlx5: fix RSS expand for IP-in-IP Thread-Index: AQHVQhNs/wOvd0UpzUCS0DklHG/oz6bt7AaA Date: Tue, 6 Aug 2019 09:20:09 +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=viacheslavo@mellanox.com; x-originating-ip: [95.67.35.250] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7b86d71e-afcd-4295-75b7-08d71a4f4845 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:AM4PR05MB3506; x-ms-traffictypediagnostic: AM4PR05MB3506: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-forefront-prvs: 0121F24F22 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(136003)(366004)(39860400002)(396003)(376002)(346002)(13464003)(199004)(189003)(86362001)(8936002)(107886003)(81156014)(81166006)(6246003)(2906002)(305945005)(478600001)(68736007)(8676002)(53936002)(66066001)(53546011)(76176011)(7736002)(74316002)(110136005)(54906003)(25786009)(6506007)(9686003)(55016002)(71200400001)(316002)(186003)(26005)(102836004)(71190400001)(4326008)(7696005)(3846002)(6116002)(229853002)(256004)(14444005)(486006)(446003)(52536014)(11346002)(476003)(5660300002)(6636002)(33656002)(14454004)(66476007)(6436002)(99286004)(76116006)(66556008)(66946007)(64756008)(66446008); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3506; H:AM4PR05MB3265.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: PLz7UhpWWAacHQytxKLy5yFpwBrIt7Rqh44OJehzu66JvJIJs1g6C/QKt76dor79TU1JUvq3t68YMP6VhYyUE7APt/Qkn2HXSh6KF5do3IyDI0AXD/RVhpoinlnJPEWUOacRMF90Nm7nuxTlZ+0JxG54QhLxQAbuXH+KCvV3IXkZflPbgZkPMPGJLkvRonvkj6Kz1uYbiT/rzYra1wxFIJrRLEgf1hxFea7VM9VyrPL/kmEGKP7box+EqzmZ9eH+fawOWFxfbwOl/1fkRHoSHNRB3gPi51/qxBKPjOl9UM55Wwxob5ljJKqhxlbxO7WFWg3CcihB+8srNJ1bvAqk3owVf+ty9cwpyZ1dGB4A005vnJQJfy0igLf5Pz6BkEG0rBVEXApkHsB92PZU4/gmO/Ghl57VTtkub0Z2jDsYGCo= 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: 7b86d71e-afcd-4295-75b7-08d71a4f4845 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Aug 2019 09:20:10.3830 (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-CrossTenant-userprincipalname: viacheslavo@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3506 Subject: Re: [dpdk-dev] [Suspected-Phishing][PATCH] net/mlx5: fix RSS expand for IP-in-IP 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Xiaoyu Min > Sent: Wednesday, July 24, 2019 14:32 > To: Shahaf Shuler ; Yongseok Koh > ; Slava Ovsiienko > Cc: dev@dpdk.org; Jack Min > Subject: [Suspected-Phishing][PATCH] net/mlx5: fix RSS expand for IP-in-I= P >=20 > The RSS expand function for IP-in-IP tunnel type is missed, which leads t= o > create following flow failed: >=20 > flow create 0 ingress pattern eth / ipv4 proto is 4 / > ipv4 / udp / end actions rss queues 0 1 end level 2 > types ip ipv4-other udp ipv4 ipv4-frag end / > mark id 221 / count / end >=20 > In order to make RSS expand function working correctly, now the way to > check whether a IP tunnel existing is to check whether there is the secon= d > IPv4/IPv6 item and whether the first IPv4/IPv6 item's next protocl is > IPPROTO_IPIP/IPPROTO_IPV6. > For example: > ... pattern eth / ipv4 proto is 4 / ipv4 / .... >=20 > Fixes: 5e33bebdd8d3 ("net/mlx5: support IP-in-IP tunnel") > Cc: jackmin@mellanox.com >=20 > Signed-off-by: Xiaoyu Min Acked-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5_flow.c | 8 +++- > drivers/net/mlx5/mlx5_flow_dv.c | 79 ++++++++++++++++++++------------- > 2 files changed, 53 insertions(+), 34 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c > index 3d2d5fc53a..f117369fa9 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -127,7 +127,9 @@ static const struct rte_flow_expand_node > mlx5_support_expansion[] =3D { > .next =3D RTE_FLOW_EXPAND_RSS_NEXT > (MLX5_EXPANSION_OUTER_IPV4_UDP, > MLX5_EXPANSION_OUTER_IPV4_TCP, > - MLX5_EXPANSION_GRE), > + MLX5_EXPANSION_GRE, > + MLX5_EXPANSION_IPV4, > + MLX5_EXPANSION_IPV6), > .type =3D RTE_FLOW_ITEM_TYPE_IPV4, > .rss_types =3D ETH_RSS_IPV4 | ETH_RSS_FRAG_IPV4 | > ETH_RSS_NONFRAG_IPV4_OTHER, > @@ -145,7 +147,9 @@ static const struct rte_flow_expand_node > mlx5_support_expansion[] =3D { > [MLX5_EXPANSION_OUTER_IPV6] =3D { > .next =3D RTE_FLOW_EXPAND_RSS_NEXT > (MLX5_EXPANSION_OUTER_IPV6_UDP, > - MLX5_EXPANSION_OUTER_IPV6_TCP), > + MLX5_EXPANSION_OUTER_IPV6_TCP, > + MLX5_EXPANSION_IPV4, > + MLX5_EXPANSION_IPV6), > .type =3D RTE_FLOW_ITEM_TYPE_IPV6, > .rss_types =3D ETH_RSS_IPV6 | ETH_RSS_FRAG_IPV6 | > ETH_RSS_NONFRAG_IPV6_OTHER, > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c index f1d32bdff0..2ff8c673b0 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -146,36 +146,20 @@ struct field_modify_info modify_tcp[] =3D { }; >=20 > static void > -mlx5_flow_tunnel_ip_check(const struct rte_flow_item *item, uint64_t > *flags) > +mlx5_flow_tunnel_ip_check(const struct rte_flow_item *item > __rte_unused, > + uint8_t next_protocol, uint64_t *item_flags, > + int *tunnel) > { > - uint8_t next_protocol =3D 0xFF; > - > - if (item->mask !=3D NULL) { > - switch (item->type) { > - case RTE_FLOW_ITEM_TYPE_IPV4: > - next_protocol =3D > - ((const struct rte_flow_item_ipv4 *) > - (item->spec))->hdr.next_proto_id; > - next_protocol &=3D > - ((const struct rte_flow_item_ipv4 *) > - (item->mask))->hdr.next_proto_id; > - break; > - case RTE_FLOW_ITEM_TYPE_IPV6: > - next_protocol =3D > - ((const struct rte_flow_item_ipv6 *) > - (item->spec))->hdr.proto; > - next_protocol &=3D > - ((const struct rte_flow_item_ipv6 *) > - (item->mask))->hdr.proto; > - break; > - default: > - break; > - } > + assert(item->type =3D=3D RTE_FLOW_ITEM_TYPE_IPV4 || > + item->type =3D=3D RTE_FLOW_ITEM_TYPE_IPV6); > + if (next_protocol =3D=3D IPPROTO_IPIP) { > + *item_flags |=3D MLX5_FLOW_LAYER_IPIP; > + *tunnel =3D 1; > + } > + if (next_protocol =3D=3D IPPROTO_IPV6) { > + *item_flags |=3D MLX5_FLOW_LAYER_IPV6_ENCAP; > + *tunnel =3D 1; > } > - if (next_protocol =3D=3D IPPROTO_IPIP) > - *flags |=3D MLX5_FLOW_LAYER_IPIP; > - if (next_protocol =3D=3D IPPROTO_IPV6) > - *flags |=3D MLX5_FLOW_LAYER_IPV6_ENCAP; > } >=20 > /** > @@ -2902,6 +2886,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const > struct rte_flow_attr *attr, >=20 > MLX5_FLOW_LAYER_OUTER_VLAN; > break; > case RTE_FLOW_ITEM_TYPE_IPV4: > + mlx5_flow_tunnel_ip_check(items, next_protocol, > + &item_flags, &tunnel); > ret =3D mlx5_flow_validate_item_ipv4(items, > item_flags, > NULL, error); > if (ret < 0) > @@ -2921,9 +2907,10 @@ flow_dv_validate(struct rte_eth_dev *dev, const > struct rte_flow_attr *attr, > /* Reset for inner layer. */ > next_protocol =3D 0xff; > } > - mlx5_flow_tunnel_ip_check(items, &last_item); > break; > case RTE_FLOW_ITEM_TYPE_IPV6: > + mlx5_flow_tunnel_ip_check(items, next_protocol, > + &item_flags, &tunnel); > ret =3D mlx5_flow_validate_item_ipv6(items, > item_flags, > NULL, error); > if (ret < 0) > @@ -2943,7 +2930,6 @@ flow_dv_validate(struct rte_eth_dev *dev, const > struct rte_flow_attr *attr, > /* Reset for inner layer. */ > next_protocol =3D 0xff; > } > - mlx5_flow_tunnel_ip_check(items, &last_item); > break; > case RTE_FLOW_ITEM_TYPE_TCP: > ret =3D mlx5_flow_validate_item_tcp > @@ -4686,6 +4672,7 @@ flow_dv_translate(struct rte_eth_dev *dev, > uint32_t modify_action_position =3D UINT32_MAX; > void *match_mask =3D matcher.mask.buf; > void *match_value =3D dev_flow->dv.value.buf; > + uint8_t next_protocol =3D 0xff; >=20 > flow->group =3D attr->group; > if (attr->transfer) > @@ -5007,6 +4994,8 @@ flow_dv_translate(struct rte_eth_dev *dev, >=20 > MLX5_FLOW_LAYER_OUTER_VLAN); > break; > case RTE_FLOW_ITEM_TYPE_IPV4: > + mlx5_flow_tunnel_ip_check(items, next_protocol, > + &item_flags, &tunnel); > flow_dv_translate_item_ipv4(match_mask, > match_value, > items, tunnel, attr->group); > matcher.priority =3D MLX5_PRIORITY_MAP_L3; @@ - > 5017,9 +5006,23 @@ flow_dv_translate(struct rte_eth_dev *dev, > MLX5_IPV4_IBV_RX_HASH); > last_item =3D tunnel ? > MLX5_FLOW_LAYER_INNER_L3_IPV4 : >=20 > MLX5_FLOW_LAYER_OUTER_L3_IPV4; > - mlx5_flow_tunnel_ip_check(items, &last_item); > + if (items->mask !=3D NULL && > + ((const struct rte_flow_item_ipv4 *) > + items->mask)->hdr.next_proto_id) { > + next_protocol =3D > + ((const struct rte_flow_item_ipv4 *) > + (items->spec))->hdr.next_proto_id; > + next_protocol &=3D > + ((const struct rte_flow_item_ipv4 *) > + (items->mask))->hdr.next_proto_id; > + } else { > + /* Reset for inner layer. */ > + next_protocol =3D 0xff; > + } > break; > case RTE_FLOW_ITEM_TYPE_IPV6: > + mlx5_flow_tunnel_ip_check(items, next_protocol, > + &item_flags, &tunnel); > flow_dv_translate_item_ipv6(match_mask, > match_value, > items, tunnel, attr->group); > matcher.priority =3D MLX5_PRIORITY_MAP_L3; @@ - > 5030,7 +5033,19 @@ flow_dv_translate(struct rte_eth_dev *dev, > MLX5_IPV6_IBV_RX_HASH); > last_item =3D tunnel ? > MLX5_FLOW_LAYER_INNER_L3_IPV6 : >=20 > MLX5_FLOW_LAYER_OUTER_L3_IPV6; > - mlx5_flow_tunnel_ip_check(items, &last_item); > + if (items->mask !=3D NULL && > + ((const struct rte_flow_item_ipv6 *) > + items->mask)->hdr.proto) { > + next_protocol =3D > + ((const struct rte_flow_item_ipv6 *) > + items->spec)->hdr.proto; > + next_protocol &=3D > + ((const struct rte_flow_item_ipv6 *) > + items->mask)->hdr.proto; > + } else { > + /* Reset for inner layer. */ > + next_protocol =3D 0xff; > + } > break; > case RTE_FLOW_ITEM_TYPE_TCP: > flow_dv_translate_item_tcp(match_mask, > match_value, > -- > 2.21.0