From patchwork Thu Apr 26 16:17:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrien Mazarguil X-Patchwork-Id: 39049 X-Patchwork-Delegate: shahafs@mellanox.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 906C18E7D; Thu, 26 Apr 2018 18:18:02 +0200 (CEST) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by dpdk.org (Postfix) with ESMTP id 510068E59 for ; Thu, 26 Apr 2018 18:18:01 +0200 (CEST) Received: by mail-wm0-f67.google.com with SMTP id j4so13990957wme.1 for ; Thu, 26 Apr 2018 09:18:01 -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:mime-version:content-disposition; bh=m1vAzISVqj3HaDH2lbDrK00KrxZf65D3gya7YBMT8yA=; b=f7Yw6Z9Oh8CmYRhlXTZdmz7zFhSw0O0tjqo196MvtygH3/q8T0ChNyY/lHj4Gak9Zl 1q+nN6ITn2OB/0XYcmYt/fKkz8PW9nPQw455c2M7Dso1MHlDkM1Y5DJEa4aBx/PETA1K SkYtgBaGHjZjQSAYbLjNyrOiI9whBbPFijrTfxHaB5vGf0Qms3W4sbKO5WF9bMyxe/Vq xb7/X3unnBGR9GmzJehWNAETpj8oR7blAhtB6ybC1i0cgW7TF/cjOOCxZovAgY1TGtwi hfT57X5D1LVi7yiCKezgoxW5OdayZd9hUxS+8NYEB7Us1+aKtPehwnw32KhUkGsv8lof NufA== 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:mime-version :content-disposition; bh=m1vAzISVqj3HaDH2lbDrK00KrxZf65D3gya7YBMT8yA=; b=B9TbEwOY3huidQTYJilFllu7LjJxgJvy1XYAFx/saLNZLJxeJuRFFghqbpnI4uYjl+ cAySlE4cQlnc0XqPQLaxAjrmfJ4MWfMvzuW7j8pFwFN8PVeLim9uwpi/xNP/5vnBTInm WpYOkjTKz4Z5+SKx4HKyTk4959YRYSu0F0Dgh9oMBvNJxJFSNcylhp3PB0TQ1OacPfwf mRLtfE0UCatxX7w2DPIKZaLkvuRrPVNMXCLn7GdZX4DJdWLzQnFDPeI0PndKSxQOoKJH TPwePsCMG1KETVM79LPQcAQgP6oMhmDHvNbtzJ7aFZTXwZz3ySXky9xpyfSoeYav+d+L 0acg== X-Gm-Message-State: ALQs6tARyrEoGiUnE+bt8LIferFPRaxi9TrAr8bSiHa9Q3Y7NZ1KZ/U5 yrsknDzdgDuGSMRVEbbERfgoyw== X-Google-Smtp-Source: AIpwx4+NRZOLpoPZP0M7SXtL6KMC/h4sjOMpLPv8A5D+G89DbCFpMVm5nCX2Lk1yh67zatxMolci7Q== X-Received: by 10.28.153.199 with SMTP id b190mr20226645wme.104.1524759481041; Thu, 26 Apr 2018 09:18:01 -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 i44-v6sm17103666wri.17.2018.04.26.09.18.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Apr 2018 09:18:00 -0700 (PDT) Date: Thu, 26 Apr 2018 18:17:46 +0200 From: Adrien Mazarguil To: Nelio Laranjeiro Cc: Shahaf Shuler , dev@dpdk.org, stable@dpdk.org Message-ID: <20180426161641.5788-1-adrien.mazarguil@6wind.com> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH v1] net/mlx5: fix flow director rule deletion crash 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" Flow director rules matching traffic properties above layer 2 do not target a fixed hash Rx queue (HASH_RXQ_ETH), it actually depends on the highest protocol layer specified by each flow rule. mlx5_fdir_filter_delete() makes this wrong assumption and causes a crash when attempting to destroy flow rules with L3/L4 specifications. Fixes: 4c3e9bcdd52e ("net/mlx5: support flow director") Cc: Nelio Laranjeiro Cc: stable@dpdk.org Signed-off-by: Adrien Mazarguil Acked-by: Nelio Laranjeiro --- drivers/net/mlx5/mlx5_flow.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 8f5fcf4d6..05def2b14 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -3409,13 +3409,13 @@ mlx5_fdir_filter_delete(struct rte_eth_dev *dev, if (parser.drop) { struct ibv_flow_spec_action_drop *drop; - drop = (void *)((uintptr_t)parser.queue[HASH_RXQ_ETH].ibv_attr + - parser.queue[HASH_RXQ_ETH].offset); + drop = (void *)((uintptr_t)parser.queue[parser.layer].ibv_attr + + parser.queue[parser.layer].offset); *drop = (struct ibv_flow_spec_action_drop){ .type = IBV_FLOW_SPEC_ACTION_DROP, .size = sizeof(struct ibv_flow_spec_action_drop), }; - parser.queue[HASH_RXQ_ETH].ibv_attr->num_of_specs++; + parser.queue[parser.layer].ibv_attr->num_of_specs++; } TAILQ_FOREACH(flow, &priv->flows, next) { struct ibv_flow_attr *attr; @@ -3426,8 +3426,8 @@ mlx5_fdir_filter_delete(struct rte_eth_dev *dev, void *flow_spec; unsigned int specs_n; - attr = parser.queue[HASH_RXQ_ETH].ibv_attr; - flow_attr = flow->frxq[HASH_RXQ_ETH].ibv_attr; + attr = parser.queue[parser.layer].ibv_attr; + flow_attr = flow->frxq[parser.layer].ibv_attr; /* Compare first the attributes. */ if (memcmp(attr, flow_attr, sizeof(struct ibv_flow_attr))) continue;