From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f178.google.com (mail-wr0-f178.google.com [209.85.128.178]) by dpdk.org (Postfix) with ESMTP id DE6151B024 for ; Mon, 16 Apr 2018 10:13:34 +0200 (CEST) Received: by mail-wr0-f178.google.com with SMTP id q13so19862878wre.3 for ; Mon, 16 Apr 2018 01:13:34 -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=kMUY32lhft0uBzeUu9Dh6dMciad/EpcW1S06TWWGdro=; b=f8hvliRmeY6hIw7FPqjqkf8sd4niDn/kt0oC3TK8aHGmRPyGXZUyfcpV7rNHVIog07 xjUR3Mtu47VS+InifnZ96JPLu9cI/M1/xDWIKksQ3bI4CnE+N2PSwz9gFTaTPqiYtTLN qhOW3BPbCeo0Uh8wUmZxs7ce5ZhAVCuQuA4CXPUOUUuP+85a0l0xAqDf22yUCofI8Hyi wexK9+1/4H5tklL5T0FYk8ftEk8TWGz4YWeR13vsTk0c5QZ3M8Qto3Pq5QhggouL5nMY 6f7+oW/sriba5LB/jHCd0Scl7Zq3ARXKcvNoUyY18WwSRHIqay7j76DPjwgyB4FsaXW+ /JHA== 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=kMUY32lhft0uBzeUu9Dh6dMciad/EpcW1S06TWWGdro=; b=YQOzHJzP+dXRi4ndmosZ6G4AzP43nA96xTZ0+2/xGqMAYbp3Z6LmWbQqpZbwPQ5OVf D5Odx8um2LU/vXkKXLby66FdMdEbbbKanI2Wg/0MZxBE5HsvD/o81yvkOiE9/EPkV1b2 BF9JUFsOYMzanZVdmNvyerihJ/6GRlBgDM/Mz739ZX2uXLbfCS+40wsxOwM2RtD5wvui SiXvlN4Xc4PHOKV0sk7Q9iX+u6h/TIOVQ7c/JJTim0jSPEdrY66Ia3RBC06gD6RkCSyS y+fK9jHBeB6EjSPO2SZ+PBQ63O0qO1EwjURF55ZOr+ctbcDHs6SiZ3LFsUxELlYH4FVL e1bQ== X-Gm-Message-State: ALQs6tAPrU68L0CwxWu5wcytJN35XYg9myeryX2ZATgL9AlJI3BtvqC5 5OptsdHJuCtLQqRsxAmD7BL+JZKKsQ== X-Google-Smtp-Source: AIpwx48TO5D9LCvjEy1IxyJBVcotYf4KX5MEmqt+ZDRM6i5XzYfCyQ7otyHzxaN3wTvHAP9vWdP2sw== X-Received: by 10.223.136.76 with SMTP id e12mr220395wre.30.1523866414595; Mon, 16 Apr 2018 01:13:34 -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 p4sm12508442wrh.3.2018.04.16.01.13.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Apr 2018 01:13:33 -0700 (PDT) Date: Mon, 16 Apr 2018 10:14:04 +0200 From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro To: "Xueming(Steven) Li" Cc: Shahaf Shuler , "dev@dpdk.org" Message-ID: <20180416081404.4il6ldqhruhzn66g@laranjeiro-vm.dev.6wind.com> References: <20180410133415.189905-1-xuemingl%40mellanox.com> <20180413112023.106420-12-xuemingl@mellanox.com> <20180413133717.afxaqj6i6pr53vdh@laranjeiro-vm.dev.6wind.com> <20180413145539.22roooz6ikcvkvg2@laranjeiro-vm.dev.6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH v3 11/14] net/mlx5: support MPLS-in-GRE and MPLS-in-UDP 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: Mon, 16 Apr 2018 08:13:35 -0000 On Fri, Apr 13, 2018 at 03:22:50PM +0000, Xueming(Steven) Li wrote: >[...] > > @@ > > > > static > > > > > const struct mlx5_flow_items mlx5_flow_items[] = { > > > > > .convert = mlx5_flow_create_vxlan_gpe, > > > > > .dst_sz = sizeof(struct ibv_flow_spec_tunnel), > > > > > }, > > > > > + [RTE_FLOW_ITEM_TYPE_MPLS] = { > > > > > + .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_mpls){ > > > > > + .label_tc_s = "\xff\xff\xf0", > > > > > + }, > > > > > + .default_mask = &rte_flow_item_mpls_mask, > > > > > + .mask_sz = sizeof(struct rte_flow_item_mpls), > > > > > + .convert = mlx5_flow_create_mpls, #ifdef > > > > > +HAVE_IBV_DEVICE_MPLS_SUPPORT > > > > > + .dst_sz = sizeof(struct ibv_flow_spec_mpls), #endif > > > > > + }, > > > > > > > > Why the whole item is not under ifdef? > > > > > > If apply macro to whole item, there will be a null pointer if create > > mpls flow. > > > There is a macro in function mlx5_flow_create_mpls() to avoid using this > > invalid data. > > > > I think there is some kind of confusion here, what I mean is moving the > > #ifdef to embrace the whole stuff i.e.: > > > > #ifdef HAVE_IBV_DEVICE_MPLS_SUPPORT > > [RTE_FLOW_ITEM_TYPE_MPLS] = { > > .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_mpls){ > > .label_tc_s = "\xff\xff\xf0", > > }, > > .default_mask = &rte_flow_item_mpls_mask, > > .mask_sz = sizeof(struct rte_flow_item_mpls), > > .convert = mlx5_flow_create_mpls, > > .dst_sz = sizeof(struct ibv_flow_spec_mpls) #endif > > > > Not having this item in this static array ends by not supporting it, this > > is what I mean. > > Yes, I know. There is a code using this array w/o NULL check: > cur_item = &mlx5_flow_items[items->type]; > ret = cur_item->convert(items, > (cur_item->default_mask ? > cur_item->default_mask : > cur_item->mask), > &data); > > This code is after the mlx5_flow_convert_items_validate() which refuses unknown items, if you you see an unknown item reaching this code above, there is bug somewhere and it should be fixed. Un-supported items should not be in the static array. Regards, -- Nélio Laranjeiro 6WIND