From patchwork Thu Oct 12 12:19:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrien Mazarguil X-Patchwork-Id: 30263 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 [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EC2B11B2F1; Thu, 12 Oct 2017 14:20:29 +0200 (CEST) Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id 099BD1B2D9 for ; Thu, 12 Oct 2017 14:20:23 +0200 (CEST) Received: by mail-wm0-f49.google.com with SMTP id i124so12807169wmf.3 for ; Thu, 12 Oct 2017 05:20:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0t5zKuB8490XL+vkydLtU7mvEhYGgiih2uISfXMHiBE=; b=fY6eNCRHIJr3pNO75a/FgcON9FYhHdIWjBFuCh6DDa2Yg97nGXWgV7c8W8X642SP/G X3BlCXINAKqIrayLPDeRjf7MFlgTAh1jXytq8JNV9LakjyVD9ScuwnJtFqIofROnzTG3 BLCNdw8n+5BsifGDx//9B4uY2sGCENDoszryfl6fLzujLhdGLQPWnJQUe1WnncgLp0Hm QE/F5lMW56JuwsMLqsxmJGaobnAUtKuhqSLcTbm8nrrKIL3WNmSX+1ojOCoPFVSuQHLY JY1/CkdENr0jFKxM7XVd9R3GzvBcAae2YDkDqs1W/pulCHCeORyBpO/zI0zSiQlYy+wo mkHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0t5zKuB8490XL+vkydLtU7mvEhYGgiih2uISfXMHiBE=; b=NHs/wqnsGMCnmhVYrnK08MZj2AL3PdO0TulIQGiaP93c3qv/cOUD/JnxjQE38a9qKQ 7Ioz5neoJ+x/0xNT1EpmHBviIoKXnLj9Vbpuj24tnmwMTO9cVMzU8mjsjjwMTXi8o4Na +mltOaPwqDUIuWPSBG4Zoq+Eht0TEidG5r2OrmdXYhUQOBOhKomXWtmiFE2EQsK4wJlN oFqJkxUNGQYhOBH+UtBBRRAPPDTpLw6GplNmXVjiDmqJRPI7hPaWRRuH9SnWRy/Tn/Ew e7g15O/r0dxDqQ9Yp3iINHduEL/GMymnNKbhY7bWssfTSz0mHnyq3O+cYPSCDYuOuqE2 9kUQ== X-Gm-Message-State: AMCzsaXzRdOOyxAzyrEd7R/kGARnxpjOABmsXjR18l7qdxLF2121GRgF aFbLwOCU7OjQJUEfUbkk1rzQPA== X-Google-Smtp-Source: AOwi7QCcz2rH8Ax59CNT8bAhIKMa+/0eM3QtBXppwUqRHnTlOHvPYMwbNyej3nJ0B8vmE0AkRYfSIA== X-Received: by 10.28.8.212 with SMTP id 203mr1686824wmi.43.1507810823566; Thu, 12 Oct 2017 05:20:23 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id l9sm13778974wrf.70.2017.10.12.05.20.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Oct 2017 05:20:22 -0700 (PDT) From: Adrien Mazarguil To: Ferruh Yigit Cc: Nelio Laranjeiro , dev@dpdk.org Date: Thu, 12 Oct 2017 14:19:26 +0200 Message-Id: <0d922526046f18e140e7807f87b7e11084702853.1507809961.git.adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 12/29] net/mlx4: relax check on missing flow rule target 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" Creating a flow rule targeting a missing (unconfigured) queue is not possible. However, nothing really prevents the destruction of a queue with existing flow rules still pointing at it, except currently the port must be in a stopped state in order to avoid crashing. Problem is that the port cannot be restarted if flow rules cannot be re-applied due to missing queues. This flexibility will be needed by subsequent work on this PMD. Given that a PMD cannot decide on its own to remove problematic user-defined flow rules in order to restart a port, work around this restriction by making the affected ones drop-like, i.e. rules targeting nonexistent queues drop packets instead. Signed-off-by: Adrien Mazarguil Acked-by: Nelio Laranjeiro --- drivers/net/mlx4/mlx4_flow.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index 8f4898b..669eba2 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -850,20 +850,24 @@ mlx4_flow_toggle(struct priv *priv, mlx4_drop_put(priv->drop); return 0; } - if (flow->ibv_flow) - return 0; - assert(flow->queue ^ flow->drop); if (flow->queue) { - struct rxq *rxq; + struct rxq *rxq = NULL; - assert(flow->queue_id < priv->dev->data->nb_rx_queues); - rxq = priv->dev->data->rx_queues[flow->queue_id]; - if (!rxq) { - err = EINVAL; - msg = "target queue must be configured first"; - goto error; + if (flow->queue_id < priv->dev->data->nb_rx_queues) + rxq = priv->dev->data->rx_queues[flow->queue_id]; + if (flow->ibv_flow) { + if (!rxq ^ !flow->drop) + return 0; + /* Verbs flow needs updating. */ + claim_zero(ibv_destroy_flow(flow->ibv_flow)); + flow->ibv_flow = NULL; + if (flow->drop) + mlx4_drop_put(priv->drop); } - qp = rxq->qp; + if (rxq) + qp = rxq->qp; + /* A missing target queue drops traffic implicitly. */ + flow->drop = !rxq; } if (flow->drop) { mlx4_drop_get(priv); @@ -876,6 +880,8 @@ mlx4_flow_toggle(struct priv *priv, } assert(qp); assert(flow->ibv_attr); + if (flow->ibv_flow) + return 0; flow->ibv_flow = ibv_create_flow(qp, flow->ibv_attr); if (flow->ibv_flow) return 0;