From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 5330C1C0E0 for ; Fri, 13 Apr 2018 14:02:06 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id x82so3767542wmg.1 for ; Fri, 13 Apr 2018 05:02:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=y874sQRlEpPOFS0ge8O3I9u1TacdRna8RJqU+YRJqsc=; b=IuCt4UyxNB4+8Y1lDU2mQUHd4p16mbucFSVVELdAjgcGn6hqT0FVFCWBhe/P6nrwA+ yI+wlFsYcEtt2VfuPlT4fVF+6AgvQZ33AElQOtJSnOC4BuaPXJv7/upVen1+8lwoCwPd 9O12dfPqvAT98lp1LJNrOIrUGgelnVvriltQNQ52/DUDd6rr8b+7ykrOAqhHZfzSpWJ7 oYTaVX3vhcvdyJ7cpihC9Wau+Xg+pupyjVVHHy7aWkkxCYn1rvcQPByOG2N0VTGsDQfi mHEIpPBgahJT4j92Dge+yELEE2HSOokSoutkwgsj+Qmzo+hwwUYSqtv8F/yvK8pMaT90 OUTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=y874sQRlEpPOFS0ge8O3I9u1TacdRna8RJqU+YRJqsc=; b=aYbFi8sCy8dpj4i4K7TPYcP2PM86xTMPFMgDj2PxWZLwJEHeXYc6cQRPS9LF6hHktA S8DqxZFsnTPkRjuovjey7YutwlZ2hpZ6CYbubSBnoDWHMi1KX9qfU+Zuq5lU0UIuU5fA ij223JrI9T4YqeiGwsmRudd+juV9QlOJLI+XDLZVj9uHAWc+wjTieBjdT0LckiAIVQGO rp0c1MAQIRTdBkFt1cK58SctLQep2TsUNJ2PWcUExMqfnkJ5LkFTBxQaOXAmm2hOp+ux UGnDWSxQNoAguxdd9Il4EAGjNVNIBAD295dzDrZBpO8IMMKNNBILPdqMzV1mUOXMbxJq Hj0A== X-Gm-Message-State: ALQs6tD2L7Hw89LHJyW2fh5zRTafBOUWv7oZ0WSbIcG9c8GzCOJ9DyL0 CEVu8dUNprsvB0OVfxfj29fQ X-Google-Smtp-Source: AIpwx4+mBGpntZ59UI/vqXZRUPagl+uDi3CAIYtOdpDXJy4zJaXOLBewtIeLtGvWZ6deX4adw/Bp0Q== X-Received: by 10.28.55.129 with SMTP id e123mr3266448wma.141.1523620925199; Fri, 13 Apr 2018 05:02:05 -0700 (PDT) Received: from laranjeiro-vm.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id e128sm1722789wmg.7.2018.04.13.05.02.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Apr 2018 05:02:04 -0700 (PDT) Date: Fri, 13 Apr 2018 14:02:28 +0200 From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro To: Xueming Li Cc: Shahaf Shuler , dev@dpdk.org Message-ID: <20180413120228.3unmgfrhqj5nkimk@laranjeiro-vm.dev.6wind.com> References: <20180410133415.189905-1-xuemingl%40mellanox.com> <20180413112023.106420-3-xuemingl@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180413112023.106420-3-xuemingl@mellanox.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH v3 02/14] net/mlx5: support GRE tunnel flow 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, 13 Apr 2018 12:02:06 -0000 Some nits, On Fri, Apr 13, 2018 at 07:20:11PM +0800, Xueming Li wrote: > Support GRE tunnel type flow. Not sure it is necessary to copy/paste the commit title in the body. > Signed-off-by: Xueming Li > --- > drivers/net/mlx5/mlx5_flow.c | 69 +++++++++++++++++++++++++++++++++++++++----- > 1 file changed, 62 insertions(+), 7 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c > index 5c4f0b586..2aae988f2 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -90,6 +90,11 @@ mlx5_flow_create_vxlan(const struct rte_flow_item *item, > const void *default_mask, > struct mlx5_flow_data *data); > > +static int > +mlx5_flow_create_gre(const struct rte_flow_item *item, > + const void *default_mask, > + struct mlx5_flow_data *data); > + Is not there an indentation issue here? > struct mlx5_flow_parse; > > static void > @@ -232,6 +237,10 @@ struct rte_flow { > __VA_ARGS__, RTE_FLOW_ITEM_TYPE_END, \ > } > > +#define IS_TUNNEL(type) ( \ > + (type) == RTE_FLOW_ITEM_TYPE_VXLAN || \ > + (type) == RTE_FLOW_ITEM_TYPE_GRE) > + > /** Structure to generate a simple graph of layers supported by the NIC. */ > struct mlx5_flow_items { > /** List of possible actions for these items. */ > @@ -285,7 +294,8 @@ static const enum rte_flow_action_type valid_actions[] = { > static const struct mlx5_flow_items mlx5_flow_items[] = { > [RTE_FLOW_ITEM_TYPE_END] = { > .items = ITEMS(RTE_FLOW_ITEM_TYPE_ETH, > - RTE_FLOW_ITEM_TYPE_VXLAN), > + RTE_FLOW_ITEM_TYPE_VXLAN, > + RTE_FLOW_ITEM_TYPE_GRE), > }, > [RTE_FLOW_ITEM_TYPE_ETH] = { > .items = ITEMS(RTE_FLOW_ITEM_TYPE_VLAN, > @@ -317,7 +327,8 @@ static const struct mlx5_flow_items mlx5_flow_items[] = { > }, > [RTE_FLOW_ITEM_TYPE_IPV4] = { > .items = ITEMS(RTE_FLOW_ITEM_TYPE_UDP, > - RTE_FLOW_ITEM_TYPE_TCP), > + RTE_FLOW_ITEM_TYPE_TCP, > + RTE_FLOW_ITEM_TYPE_GRE), > .actions = valid_actions, > .mask = &(const struct rte_flow_item_ipv4){ > .hdr = { > @@ -334,7 +345,8 @@ static const struct mlx5_flow_items mlx5_flow_items[] = { > }, > [RTE_FLOW_ITEM_TYPE_IPV6] = { > .items = ITEMS(RTE_FLOW_ITEM_TYPE_UDP, > - RTE_FLOW_ITEM_TYPE_TCP), > + RTE_FLOW_ITEM_TYPE_TCP, > + RTE_FLOW_ITEM_TYPE_GRE), > .actions = valid_actions, > .mask = &(const struct rte_flow_item_ipv6){ > .hdr = { > @@ -387,6 +399,19 @@ static const struct mlx5_flow_items mlx5_flow_items[] = { > .convert = mlx5_flow_create_tcp, > .dst_sz = sizeof(struct ibv_flow_spec_tcp_udp), > }, > + [RTE_FLOW_ITEM_TYPE_GRE] = { > + .items = ITEMS(RTE_FLOW_ITEM_TYPE_ETH, > + RTE_FLOW_ITEM_TYPE_IPV4, > + RTE_FLOW_ITEM_TYPE_IPV6), > + .actions = valid_actions, > + .mask = &(const struct rte_flow_item_gre){ > + .protocol = -1, > + }, > + .default_mask = &rte_flow_item_gre_mask, > + .mask_sz = sizeof(struct rte_flow_item_gre), > + .convert = mlx5_flow_create_gre, > + .dst_sz = sizeof(struct ibv_flow_spec_tunnel), > + }, > [RTE_FLOW_ITEM_TYPE_VXLAN] = { > .items = ITEMS(RTE_FLOW_ITEM_TYPE_ETH), > .actions = valid_actions, > @@ -402,7 +427,7 @@ static const struct mlx5_flow_items mlx5_flow_items[] = { > > /** Structure to pass to the conversion function. */ > struct mlx5_flow_parse { > - uint32_t inner; /**< Set once VXLAN is encountered. */ > + uint32_t inner; /**< Verbs value, set once tunnel is encountered. */ > uint32_t create:1; > /**< Whether resources should remain after a validate. */ > uint32_t drop:1; /**< Target is a drop queue. */ > @@ -830,13 +855,13 @@ mlx5_flow_convert_items_validate(const struct rte_flow_item items[], > cur_item->mask_sz); > if (ret) > goto exit_item_not_supported; > - if (items->type == RTE_FLOW_ITEM_TYPE_VXLAN) { > + if (IS_TUNNEL(items->type)) { > if (parser->inner) { > rte_flow_error_set(error, ENOTSUP, > RTE_FLOW_ERROR_TYPE_ITEM, > items, > - "cannot recognize multiple" > - " VXLAN encapsulations"); > + "Cannot recognize multiple" > + " tunnel encapsulations."); > return -rte_errno; > } > parser->inner = IBV_FLOW_SPEC_INNER; > @@ -1644,6 +1669,36 @@ mlx5_flow_create_vxlan(const struct rte_flow_item *item, > } > > /** > + * Convert GRE item to Verbs specification. > + * > + * @param item[in] > + * Item specification. > + * @param default_mask[in] > + * Default bit-masks to use when item->mask is not provided. > + * @param data[in, out] > + * User structure. > + * > + * @return > + * 0 on success, a negative errno value otherwise and rte_errno is set. > + */ > +static int > +mlx5_flow_create_gre(const struct rte_flow_item *item __rte_unused, > + const void *default_mask __rte_unused, > + struct mlx5_flow_data *data) > +{ > + struct mlx5_flow_parse *parser = data->parser; > + unsigned int size = sizeof(struct ibv_flow_spec_tunnel); > + struct ibv_flow_spec_tunnel tunnel = { > + .type = parser->inner | IBV_FLOW_SPEC_VXLAN_TUNNEL, > + .size = size, > + }; > + > + parser->inner = IBV_FLOW_SPEC_INNER; > + mlx5_flow_create_copy(parser, &tunnel, size); > + return 0; > +} > + > +/** > * Convert mark/flag action to Verbs specification. > * > * @param parser > -- > 2.13.3 Thanks, -- Nélio Laranjeiro 6WIND