From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f171.google.com (mail-wr0-f171.google.com [209.85.128.171]) by dpdk.org (Postfix) with ESMTP id 7C77F7D3E for ; Thu, 24 Aug 2017 08:54:30 +0200 (CEST) Received: by mail-wr0-f171.google.com with SMTP id p14so7025961wrg.1 for ; Wed, 23 Aug 2017 23:54:30 -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=UhcuMNHQgYVbkkniMS/9DSyrgmdgjucZ04qSlWO6HEg=; b=lc7vV8NVNUCKIyoUzoxYOx+LuAeaD41Sa0q0Fvmlvb9pwnND6P0NkiQrgGoOYnlioX SLjxLJSGuckccSaVhTMhldqIa/SwkHGxSe4P8BTWuVfrsJq/DNoQaZbBG5LMc8DOuwMr 9xfunOgZ9gBwSaIkswqZtHHQu35tYPkSTYr2sBI74cgzhm5UpIm3qrLZ1vVHPcTODyKD a2e7gouEKO2u5vn7XxLkGa83cXn5xNa+kD1Wm28zPxoHdUpUxqaq09DzdUMNLGMRPmGF Ecyw5D2XQa5S5iMj7OApxF9NbtgRwGSWdQ3ewUz8hvsyYl3uBnBts+TfjexEpN4GFuGT qYhQ== 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=UhcuMNHQgYVbkkniMS/9DSyrgmdgjucZ04qSlWO6HEg=; b=PvOanw9hHB9X6HDLrwTIG59mf+ETFU3BuT5v9uPWBWgTBcqvZ9k5WMiBrZzpnXr076 AdN6YR3I1eYciCx9SYo2eQ/jAATEfD8b89dCZS9JeBHfJB/Ylkd716gSTgyRk/HIBPh1 LulFJtSff5HDT9lYsUuG669DsxvA//FzmX72MhERP38UiPRnf3vwHB/vVUdOFnWNM0Fv hmXCruOWM2Qmgo/LhG4QcrTP6j7AtLMmB+2XK1YsGoczn6jVMd+WxcBJ9DYeDRoTONJi CwuUb7qhtkMzDBgJOW0O8Gf3G/HyxVSqn5syCvG/GWAi9jocMqLmKWs5hmF4EccpTFiv UY7g== X-Gm-Message-State: AHYfb5j0Z7k67yJfz2rf1Kl4tXan8QXofHLE/hAnTcnySH2lOLnjZl0n 9TwUOHH2JF6jKPW1 X-Received: by 10.223.151.44 with SMTP id r41mr3417706wrb.189.1503557670072; Wed, 23 Aug 2017 23:54:30 -0700 (PDT) Received: from autoinstall.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id x67sm3872707wma.20.2017.08.23.23.54.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Aug 2017 23:54:29 -0700 (PDT) Date: Thu, 24 Aug 2017 08:54:19 +0200 From: =?iso-8859-1?Q?N=E9lio?= Laranjeiro To: Ori Kam Cc: adrien.mazaruil@6wind.com, dev@dpdk.org Message-ID: <20170824065419.GH12995@autoinstall.dev.6wind.com> References: <1503318941-42015-1-git-send-email-orika@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1503318941-42015-1-git-send-email-orika@mellanox.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [RFC] net/mlx5: support count flow action 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: Thu, 24 Aug 2017 06:54:30 -0000 Hi Ori, Please keep the coding style of the file, and pass checkpatch before submitting a patch on the mailing list. It helps the review by having a correct patch respecting the coding style of the file. I won't spot out here all the coding style issues, if you need some help, feel free to ask. On Mon, Aug 21, 2017 at 03:35:41PM +0300, Ori Kam wrote: > Support count flow action. Why copy/pasting the title in the commit message? > This patch is basic design only, do to missing features on the verbs > driver. As soon as the features will be implemented on the verbs driver this > will be updated and rebased on top of dpdk.org/ml/archives/dev/2017-August/072351.html > (The verbs driver should be ready starting September) > > This RFC should be applied on top of > dpdk.org/ml/archives/dev/2017-August/072351.html Last two comments should be after '---' line. > Signed-off-by: Ori Kam > --- > drivers/net/mlx5/mlx5.h | 4 ++ > drivers/net/mlx5/mlx5_flow.c | 163 ++++++++++++++++++++++++++++++++++++++++++- There are missing changes in the Makefile to have the HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_COUNT and the include of the mlx5_autoconf.h in mlx5_flow.c. > 2 files changed, 166 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h > index e89aba8..434e848 100644 > --- a/drivers/net/mlx5/mlx5.h > +++ b/drivers/net/mlx5/mlx5.h >[...] > +/** > + * Query an existing flow rule. > + * > + * @see rte_flow_query() > + * @see rte_flow_ops > + */ > +int > +mlx5_flow_query(struct rte_eth_dev *dev, > + struct rte_flow *flow, > + enum rte_flow_action_type type, > + void *res, > + struct rte_flow_error *error) > +{ > + > + int res_value = 0; > + switch (type){ > + case RTE_FLOW_ACTION_TYPE_COUNT: > + if (!flow->counter) { > + rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > + NULL, > + "No counter is set for this flow"); > + return -1; Wrong returned value, read the rte_flow_query API allowed values. > + } > +#ifdef HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_COUNT > + res_value = priv_flow_query_counter(mlx5_get_priv(dev), flow->counter, > + (struct rte_flow_query_count*)res, > + error); > +#else > + rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, > + NULL, "Flow count unsupported"); > + (void)dev; > + (void)flow; > + (void)type; > + (void)res; > + (void)error; > + return -1; Same here. > +#endif I'll suggest to have a dedicated function here to handle this situation, like a mlx5_flow_query_counters() and call it from this case. It will clearly ease the readability and maintenance. Thanks, -- Nélio Laranjeiro 6WIND