From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20043.outbound.protection.outlook.com [40.107.2.43]) by dpdk.org (Postfix) with ESMTP id 710F01BDE9 for ; Sat, 7 Jul 2018 01:46:36 +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=nJ80lo4/VopgWCaATUhL1TtKW3EmBXheqWFRf6UOxyA=; b=MHWMvkTAyTWi4/NrNCgKXtFBjclmmkfatxtILTyo37Sj/qsgnrbYnlOKfTs5wEtDMW8k4CxE4C1Ppx66M+0jnGRxivb+fxPLNmfxztqDaJqcW4fDWwMvEK/r/9sw/tLMWaUrka+lAp/Vagu04XyqLIWaPeCJEr+nC6k0gyyZXdo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; Received: from yongseok-MBP.local (209.116.155.178) by VI1PR0501MB2045.eurprd05.prod.outlook.com (2603:10a6:800:36::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.19; Fri, 6 Jul 2018 23:46:27 +0000 Date: Fri, 6 Jul 2018 16:46:11 -0700 From: Yongseok Koh To: Nelio Laranjeiro Cc: dev@dpdk.org, Adrien Mazarguil Message-ID: <20180706234610.GC53779@yongseok-MBP.local> References: <6190b2d787d3a9d2095e2eed17db1c20b2e3c4e1.1530111623.git.nelio.laranjeiro@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6190b2d787d3a9d2095e2eed17db1c20b2e3c4e1.1530111623.git.nelio.laranjeiro@6wind.com> User-Agent: Mutt/1.9.3 (2018-01-21) X-Originating-IP: [209.116.155.178] X-ClientProxiedBy: MWHPR12CA0067.namprd12.prod.outlook.com (2603:10b6:300:103::29) To VI1PR0501MB2045.eurprd05.prod.outlook.com (2603:10a6:800:36::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3ce48164-1d5d-4f03-0438-08d5e39ab138 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(48565401081)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:VI1PR0501MB2045; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2045; 3:5KfYDxGdCRFoJa+WURMiEUEOGi8yaMYpDOv/LPvjAGPFbDHlxIidZoqq+z6bLwqCvDntOQwVMKMAS33pqGFq+I4dvWPHD9q+84HJ6bNrH/XrgLyRGuR6R27FY13k6CJpI1pxU/lgZZQLTPDrMJjLIZsmXHyWQUwZT9w+FGpiBoOl4yKUZtLvVmYU/ydu7j8gdY3yGVeWDmpWXdjYkBTp0lHuNjsgSiMMwe0vYa0GMGg9P9XZrPEek1IBSUUuSixQ; 25:OhDvU599JbMil31Pr1suN0DlTc++/eC/4tA9YC5+PEe1LqA0o445o2yNSJAi39paHNFs+Mv7Wqv1eqVHMhIlVWvupaW4EzKDSzxxg0oGcFRolysr1gbvxHYs3a/KijqUWpMQNaoQc14PkM6jt/vHXdRL6NFFAtILSTmTEw/StsHyMti1KbOuvNgTN3jXWPlC3Ebp7/6qYHZ39d0e7/gUISlCCcSPUV8G4S88jKGvG/41/nUm61C4H/FFDR0vmxsgjTm6+IKweYeVELBge1KgtUSnReoHgrKgMdYwOJ+us5fcwtc9WwHsOETKCmLpkfeEGB3p7E+p9nYYrWFa+Jw1Tg==; 31:DODAFaiimSBi4oApZ6SjroyqvDJSlAh8eSS2A0GU6Vr2FuU4E6u5WuKn8VPdwV9n0EFhFyVPJOzunbDKmVEmKjswxzpl0ME0+dKDzwAu9ftFIb9ZuighuBw5d/rM9P7BwzNrQ8xJ/AsMbqyIm7HsSv97arNAsqSsNwYwEREt5VStOSGKVaxxZufloaGMNqaP5ELRdsHLHYam6z/xqDaJM1mjt/ofd0MOTd5ti9uyONI= X-MS-TrafficTypeDiagnostic: VI1PR0501MB2045: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2045; 20:1ABDoWfU95x6BPn4zGVxl9inCrKVWV7nx5uKHUIaTDoM7milhIL1IIpAjzFEA6v6nOqKm++lcSMuGNfvdvsULRKvMyLNXnV/DCKqjB5pvuFicYt4vPdhRBniO4Zz5ib9CVzrvJV3I89sTKWgmydrSPADPWHWuz4Ieuosns/YV1vpCD97HwAZZ6gsepTxB6bZ2UCQX3rVi9i3TvXo4gJUo6DFCsBQSvmOH3cV3QDyzj+zuaGqd7doy9wzJS6WL72FGVW7Yiya6PdVLRJJd8vOj6rR+85ruMC909SKLIu6CiVgolslJsXN7JCFblH4DhJ7g+L+uWLTfGPcjCLmroDRr23xBHbF+hF5z61JsXDotHZytsodw/8KEMceH0Q/s+oTkKYNndHI63N04tXy9tu9EtqZtyFnebFZexmdBi65Xb3xtABmlCE6NXWCoFRnoXzAwUT3UpJSrFSP1vnY6Uy9bfXYKvfsMgtpZ0Fc3yAm9CC+/OrGboORmAsa2M3uwb2h; 4:q9GhxzOaZVySDL7R8646LSzguzvEcW5oZM7v07RXByXbnvwH/PARM8MdWZNuxuMieLVhPlaB4MBJ4ghxfep8JiOxy9MlKagNG69PCu0vXmNBkgpurIBnRPgjatZtuTDo/s5v5danC1pXZhjIYsctDmUTb9T7tLXW4W0jmJqn81CuJ+qoynoPo2d+Ffu4z5Ah6lswEkInNTAqEhnKsdH/2yhWoi/sxlWD2MgOdMz8VaNbVcASXBwJJXRkY8WOrkMuCKalHdp8d3piGxuGB32p4V1SjVWykIn5PjHkNSDWKqASEXTCtsTOgvksvX3Qg1ox X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(17755550239193); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231254)(944501410)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:VI1PR0501MB2045; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2045; X-Forefront-PRVS: 0725D9E8D0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(366004)(39850400004)(396003)(136003)(189003)(199004)(6116002)(1076002)(3846002)(47776003)(4326008)(25786009)(16586007)(53936002)(68736007)(66066001)(316002)(478600001)(58126008)(14444005)(23726003)(6666003)(305945005)(2906002)(105586002)(8676002)(52116002)(956004)(11346002)(50466002)(486006)(106356001)(446003)(86362001)(97736004)(5660300001)(6916009)(7736002)(386003)(81156014)(76176011)(7696005)(229853002)(98436002)(81166006)(476003)(8936002)(9686003)(6246003)(33896004)(186003)(55016002)(6506007)(33656002)(16526019)(26005)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2045; H:yongseok-MBP.local; 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-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0501MB2045; 23:yQqcNmutUDqDox+jXAMb/0TvMEG9uOf9LEwAreq?= =?us-ascii?Q?RbIAPaM4s3WxHq2t3qchZlRoctWYqx8bw0uMFzG5PskP5LxNy+f3cY825vS0?= =?us-ascii?Q?yoGiR5NoBSaSrt1tedOPg2WzeIfIuUjGLH4ppX/KM/3Tz9nvLw5aVmhO5Pco?= =?us-ascii?Q?Xrg7mhP0rQIbNQQrIAmmDhq+kGhOHPzZKzo18AGjhB1BM8+yZLXwbY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FyMKq0gwkNoSVVSwOOWMPKqPZyZgqr88l6FA2DqNKCM8AITL5sddFSIqsFcAbIpysz+QJ97y+3gpM8Jv0yRr4g==; 5:vLARZbf0awojykpfN6iJ9zyZHX+kOoAfjiDuRZeZIyzryNOWz4gMZIUUWQ75bR9kb5s5DDN/XTRl7uN0DX8ddxjRPvbqRf4twArNhGR9KxNDuZa9Z0kxdfrG3GDc+YeXsNDqVSoWYU2Q6Xa4FmmTFNXhACv/zSOlH55pvfPu4dQ=; 24:GZE7KPwe7iwXFROiNyH9UqoKcEP1cMfzQimgEGkAtC7FWh68BTBD2+lH4OnpmJyVm8PYosmWc4POEqV4eOEN8Z17vR8KknN3I6ErbHNLj14= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2045; 7:bvMFHGq7N0ArEFlzn9aE+kuQq+5h62G2i/k1nW0rPkccErnuSKmr5VVQ7TvJhHqm3N5/TrxEAH57Qa9nEA54uvYtA6/hCXiYrl7fnMrzW8Em1HZCb6p3p10rksyz0PZZMPN/0FX6qSZkDSLF2AOjVNfF9xHfTZet9dIlfSYY3N2LoqRJ6Ad+uTp3wbFddOOMS3mnEqyBpfdpypc01D4kJkqFhHYXHO72acyFA7ozxnNMVC4+2VCjAuc5onlOCzLo X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2018 23:46:27.1332 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3ce48164-1d5d-4f03-0438-08d5e39ab138 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2045 Subject: Re: [dpdk-dev] [PATCH v2 18/20] net/mlx5: add flow GRE item 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: Fri, 06 Jul 2018 23:46:36 -0000 On Wed, Jun 27, 2018 at 05:07:50PM +0200, Nelio Laranjeiro wrote: > Signed-off-by: Nelio Laranjeiro > --- > drivers/net/mlx5/mlx5_flow.c | 191 ++++++++++++++++++++++++++++++++++- > 1 file changed, 186 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c > index 47c55b426..636aaabe8 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -54,6 +54,7 @@ extern const struct eth_dev_ops mlx5_dev_ops_isolate; > /* Pattern tunnel Layer bits. */ > #define MLX5_FLOW_LAYER_VXLAN (1u << 12) > #define MLX5_FLOW_LAYER_VXLAN_GPE (1u << 13) > +#define MLX5_FLOW_LAYER_GRE (1u << 14) > > /* Outer Masks. */ > #define MLX5_FLOW_LAYER_OUTER_L3 \ > @@ -66,7 +67,8 @@ extern const struct eth_dev_ops mlx5_dev_ops_isolate; > > /* Tunnel masks. */ > #define MLX5_FLOW_LAYER_TUNNEL \ > - (MLX5_FLOW_LAYER_VXLAN | MLX5_FLOW_LAYER_VXLAN_GPE) > + (MLX5_FLOW_LAYER_VXLAN | MLX5_FLOW_LAYER_VXLAN_GPE | \ > + MLX5_FLOW_LAYER_GRE) > > /* Inner Masks. */ > #define MLX5_FLOW_LAYER_INNER_L3 \ > @@ -215,6 +217,9 @@ static const struct rte_flow_expand_node mlx5_support_expansion[] = { > }, > }; > > +/* Tunnel protocol values. */ > +#define MLX5_PROTOCOL_GRE 47 How about using IPPROTO_GRE instead? > + > /** Handles information leading to a drop fate. */ > struct mlx5_flow_verbs { > LIST_ENTRY(mlx5_flow_verbs) next; > @@ -1005,12 +1010,23 @@ mlx5_flow_item_ipv6(const struct rte_flow_item *item, struct rte_flow *flow, > item, > "L3 cannot follow an L4" > " layer"); > + /* > + * IPv6 is not recognised by the NIC inside a GRE tunnel. > + * Such support has to be disabled as the rule will be > + * accepted. Tested with Mellanox OFED 4.3-3.0.2.1 > + */ This comment doesn't look appropriate. Do you think it is a bug of OFED/FW, which can be fixed? Or, is it a HW erratum? Let's talk offline. > + if (tunnel && layers & MLX5_FLOW_LAYER_GRE) > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_ITEM, > + item, > + "IPv6 inside a GRE tunnel is" > + " not recognised."); > if (!mask) > mask = &rte_flow_item_ipv6_mask; > - ret = mlx5_flow_item_validate(item, (const uint8_t *)mask, > - (const uint8_t *)&nic_mask, > - sizeof(struct rte_flow_item_ipv6), > - error); > + ret = mlx5_flow_item_validate > + (item, (const uint8_t *)mask, > + (const uint8_t *)&nic_mask, > + sizeof(struct rte_flow_item_ipv6), error); > if (ret < 0) > return ret; > } > @@ -1411,6 +1427,168 @@ mlx5_flow_item_vxlan_gpe(struct rte_eth_dev *dev, > return size; > } > > +/** > + * Update the protocol in Verbs IPv4 spec. > + * > + * @param attr[in, out] > + * Pointer to Verbs attributes structure. > + * @param protocol[in] > + * Protocol value to set if none is present in the specification. > + */ > +static void > +mlx5_flow_item_gre_ipv4_protocol_update(struct ibv_flow_attr *attr, > + uint8_t protocol) > +{ > + unsigned int i; > + const enum ibv_flow_spec_type search = IBV_FLOW_SPEC_IPV4_EXT; > + struct ibv_spec_header *hdr = (struct ibv_spec_header *) > + ((uint8_t *)attr + sizeof(struct ibv_flow_attr)); > + > + if (!attr) > + return; > + for (i = 0; i != attr->num_of_specs; ++i) { > + if (hdr->type == search) { > + struct ibv_flow_spec_ipv4_ext *ip = > + (struct ibv_flow_spec_ipv4_ext *)hdr; > + > + if (!ip->val.proto) { > + ip->val.proto = protocol; > + ip->mask.proto = 0xff; > + } > + break; > + } > + hdr = (struct ibv_spec_header *)((uint8_t *)hdr + hdr->size); > + } > +} > + > +/** > + * Update the protocol in Verbs IPv6 spec. > + * > + * @param attr[in, out] > + * Pointer to Verbs attributes structure. > + * @param protocol[in] > + * Protocol value to set if none is present in the specification. > + */ > +static void > +mlx5_flow_item_gre_ipv6_protocol_update(struct ibv_flow_attr *attr, > + uint8_t protocol) How about consolidating the two funcs - mlx5_flow_item_gre_ipv6_protocol_update() and mlx5_flow_item_gre_ipv4_protocol_update()? There are many things in common. > +{ > + unsigned int i; > + const enum ibv_flow_spec_type search = IBV_FLOW_SPEC_IPV6; > + struct ibv_spec_header *hdr = (struct ibv_spec_header *) > + ((uint8_t *)attr + sizeof(struct ibv_flow_attr)); > + > + if (!attr) > + return; > + for (i = 0; i != attr->num_of_specs; ++i) { > + if (hdr->type == search) { > + struct ibv_flow_spec_ipv6 *ip = > + (struct ibv_flow_spec_ipv6 *)hdr; > + > + if (!ip->val.next_hdr) { What if protocol in IP header does have wrong value other than 47 (IPPROTO_GRE)? Shouldn't we have a validation check for it in mlx5_flow_item_gre()? > + ip->val.next_hdr = protocol; > + ip->mask.next_hdr = 0xff; > + } > + break; > + } > + hdr = (struct ibv_spec_header *)((uint8_t *)hdr + hdr->size); > + } > +} > + > +/** > + * Validate GRE layer and possibly create the Verbs specification. > + * > + * @param dev > + * Pointer to Ethernet device. > + * @param item[in] > + * Item specification. > + * @param flow[in, out] > + * Pointer to flow structure. > + * @param flow_size[in] > + * Size in bytes of the available space for to store the flow information. > + * @param error > + * Pointer to error structure. > + * > + * @return > + * size in bytes necessary for the conversion, a negative errno value > + * otherwise and rte_errno is set. > + */ > +static int > +mlx5_flow_item_gre(const struct rte_flow_item *item, > + struct rte_flow *flow, const size_t flow_size, > + struct rte_flow_error *error) > +{ > + struct mlx5_flow_verbs *verbs = flow->cur_verbs; > + const struct rte_flow_item_gre *spec = item->spec; > + const struct rte_flow_item_gre *mask = item->mask; > + const uint32_t layers = mlx5_flow_layers(flow); > +#ifdef HAVE_IBV_DEVICE_MPLS_SUPPORT > + unsigned int size = sizeof(struct ibv_flow_spec_gre); > + struct ibv_flow_spec_gre tunnel = { > + .type = IBV_FLOW_SPEC_GRE, > + .size = size, > + }; > +#else > + unsigned int size = sizeof(struct ibv_flow_spec_tunnel); > + struct ibv_flow_spec_tunnel tunnel = { > + .type = IBV_FLOW_SPEC_VXLAN_TUNNEL, > + .size = size, > + }; > +#endif > + int ret; > + > + if (layers & MLX5_FLOW_LAYER_TUNNEL) > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_ITEM, > + item, > + "a tunnel is already present"); > + if (!(layers & MLX5_FLOW_LAYER_OUTER_L3)) > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_ITEM, > + item, > + "L3 Layer is missing"); > + if (!mask) > + mask = &rte_flow_item_gre_mask; > + ret = mlx5_flow_item_validate > + (item, (const uint8_t *)mask, > + (const uint8_t *)&rte_flow_item_gre_mask, > + sizeof(struct rte_flow_item_gre), error); > + if (ret < 0) > + return ret; > +#ifdef HAVE_IBV_DEVICE_MPLS_SUPPORT > + if (spec) { > + tunnel.val.c_ks_res0_ver = spec->c_rsvd0_ver; > + tunnel.val.protocol = spec->protocol; > + tunnel.mask.c_ks_res0_ver = mask->c_rsvd0_ver; > + tunnel.mask.protocol = mask->protocol; > + /* Remove unwanted bits from values. */ > + tunnel.val.c_ks_res0_ver &= tunnel.mask.c_ks_res0_ver; > + tunnel.val.protocol &= tunnel.mask.protocol; > + tunnel.val.key &= tunnel.mask.key; > + } > +#else > + if (spec && (spec->protocol & mask->protocol)) > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_ITEM, > + item, > + "without MPLS support the" > + " specification cannot be used for" > + " filtering"); > +#endif /* !HAVE_IBV_DEVICE_MPLS_SUPPORT */ > + if (size <= flow_size) { > + if (layers & MLX5_FLOW_LAYER_OUTER_L3_IPV4) > + mlx5_flow_item_gre_ipv4_protocol_update > + (verbs->attr, MLX5_PROTOCOL_GRE); > + else > + mlx5_flow_item_gre_ipv6_protocol_update > + (verbs->attr, MLX5_PROTOCOL_GRE); > + mlx5_flow_spec_verbs_add(flow, &tunnel, size); > + } > + mlx5_flow_layers_update(flow, MLX5_FLOW_LAYER_GRE); > + flow->ptype = RTE_PTYPE_TUNNEL_GRE; > + return size; > +} > + > /** > * Validate items provided by the user. > * > @@ -1469,6 +1647,9 @@ mlx5_flow_items(struct rte_eth_dev *dev, > ret = mlx5_flow_item_vxlan_gpe(dev, items, flow, > remain, error); > break; > + case RTE_FLOW_ITEM_TYPE_GRE: > + ret = mlx5_flow_item_gre(items, flow, remain, error); > + break; > default: > return rte_flow_error_set(error, ENOTSUP, > RTE_FLOW_ERROR_TYPE_ITEM, > -- > 2.18.0 >