From patchwork Sun Jun 4 05:25:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shachar Beiser X-Patchwork-Id: 25041 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 7F37C7CDA; Sun, 4 Jun 2017 07:25:32 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id E81247CCE for ; Sun, 4 Jun 2017 07:25:30 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from shacharbe@mellanox.com) with ESMTPS (AES256-SHA encrypted); 4 Jun 2017 08:25:30 +0300 Received: from gen-r-vrt-059.mtr.labs.mlnx (gen-r-vrt-059.mtr.labs.mlnx [10.215.59.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v545PUiP023436; Sun, 4 Jun 2017 08:25:30 +0300 Received: from gen-r-vrt-059.mtr.labs.mlnx (localhost [127.0.0.1]) by gen-r-vrt-059.mtr.labs.mlnx (8.14.7/8.14.7) with ESMTP id v545PU1q007400; Sun, 4 Jun 2017 05:25:30 GMT Received: (from shacharbe@localhost) by gen-r-vrt-059.mtr.labs.mlnx (8.14.7/8.14.7/Submit) id v545PUFO007399; Sun, 4 Jun 2017 05:25:30 GMT From: Shachar Beiser To: dev@dpdk.org Cc: Adrien Mazarguil , Nelio Laranjeiro , Shachar Beiser Date: Sun, 4 Jun 2017 05:25:21 +0000 Message-Id: <1496553921-7361-2-git-send-email-shacharbe@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1496553921-7361-1-git-send-email-shacharbe@mellanox.com> References: <1496071709-6297-2-git-send-email-shacharbe@mellanox.com> <1496553921-7361-1-git-send-email-shacharbe@mellanox.com> Subject: [dpdk-dev] [PATCH v3] net/mlx5: implement drop action in hardware classifier 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" The current drop action is implemented as a queue tail drop, requiring to instantiate multiple WQs to maintain high drop rate. This commit, implements the drop action in hardware classifier. This enables to reduce the amount of contexts needed for the drop, without affecting the drop rate. Signed-off-by: Shachar Beiser --- drivers/net/mlx5/Makefile | 5 +++++ drivers/net/mlx5/mlx5_flow.c | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile index c079959..daf8013 100644 --- a/drivers/net/mlx5/Makefile +++ b/drivers/net/mlx5/Makefile @@ -101,6 +101,11 @@ mlx5_autoconf.h.new: FORCE mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh $Q $(RM) -f -- '$@' $Q sh -- '$<' '$@' \ + HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP \ + infiniband/verbs_exp.h \ + enum IBV_EXP_FLOW_SPEC_ACTION_DROP \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ HAVE_VERBS_IBV_EXP_CQ_COMPRESSED_CQE \ infiniband/verbs_exp.h \ enum IBV_EXP_CQ_COMPRESSED_CQE \ diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index adcbe3f..77a8c04 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -53,7 +53,11 @@ #include "mlx5_prm.h" /* Number of Work Queue necessary for the DROP queue. */ +#ifndef HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP #define MLX5_DROP_WQ_N 4 +#else +#define MLX5_DROP_WQ_N 1 +#endif static int mlx5_flow_create_eth(const struct rte_flow_item *item, @@ -993,6 +997,10 @@ struct mlx5_flow_action { struct rte_flow_error *error) { struct rte_flow *rte_flow; +#ifdef HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP + struct ibv_exp_flow_spec_action_drop *drop; + unsigned int size = sizeof(struct ibv_exp_flow_spec_action_drop); +#endif assert(priv->pd); assert(priv->ctx); @@ -1007,6 +1015,15 @@ struct mlx5_flow_action { rte_flow->qp = priv->flow_drop_queue->qp; if (!priv->started) return rte_flow; +#ifdef HAVE_VERBS_IBV_EXP_FLOW_SPEC_ACTION_DROP + drop = (void *)((uintptr_t)flow->ibv_attr + flow->offset); + *drop = (struct ibv_exp_flow_spec_action_drop){ + .type = IBV_EXP_FLOW_SPEC_ACTION_DROP, + .size = size, + }; + ++flow->ibv_attr->num_of_specs; + flow->offset += sizeof(struct ibv_exp_flow_spec_action_drop); +#endif rte_flow->ibv_flow = ibv_exp_create_flow(rte_flow->qp, rte_flow->ibv_attr); if (!rte_flow->ibv_flow) {