From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 8C61B1B1A8 for ; Wed, 24 Jan 2018 16:39:54 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 406D6226D3; Wed, 24 Jan 2018 10:39:54 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 24 Jan 2018 10:39:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=jqlTcXcxj7DgJKmMJ jc0LGEYPkKaTsmpb/sO/bRbBsk=; b=ncaRxB11dSU8LDAjsA/dBu2U7vF7KFfSJ dQ6sW18NER+taKkfgH1Rn771p+kxzTqhE7yMbEOVuHRKyy+0nkX76eAWk+1PEmnM 0Q712CUyKFd4cGzxAaavjJuIfb27QDftOKr15vVV7pHnXnNKC8ldvMYD+1IkEoYN si5/WtDjK+Pa7oelP1iBim7VWO1F67PdqtpRMUF2Wo7VYMCndTLAQiuh5ScAoAD0 YXFKGiX5p8HoK6/PGbFFnJZ3JSvKUdpj3PpZOz8ntwt9aiisMeB7BehL7ns6Q1Tf t+/QXpunbUfPCMjHVJc9hd67XGBB05KUygi0y7H92J5vrFpqcQs7A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=jqlTcXcxj7DgJKmMJjc0LGEYPkKaTsmpb/sO/bRbBsk=; b=ZAFbWHP/ N/oz284DT47WmP4belRs8KOD+/R8oR2kVW+6T95KGQ5z+xkLc6W/bjcsZee20d5T 4Q35djwGXSy8FNPss0x9nH0mgv9v0rjgIpVcL+YbiTPpXgX/kGzzKJPvmMTKPQqv RF2lXwXqSdMFPqS1MvJSXaeEkMq4QtlkP7RfJeFJ0mJteLHgLPjKYzTbmPubM2f+ 6X14y2LFhLi07f0JzzmY057wuJUgriUYhKbsS/wfUKZXj/Fy0Z3Xqk85FYIOmYtg yJL/bjZgGditUSDZVkovyFWc2aQHbGP1og4w34nPRzxfKkfBUZl+syMjNg2nyGn4 Rwrc+FLO3SwR8Q== X-ME-Sender: Received: from localhost.localdomain (unknown [115.150.27.206]) by mail.messagingengine.com (Postfix) with ESMTPA id 27F697E1BE; Wed, 24 Jan 2018 10:39:51 -0500 (EST) From: Yuanhan Liu To: Somnath Kotur Cc: Ajit Khaparde , dpdk stable Date: Wed, 24 Jan 2018 23:32:38 +0800 Message-Id: <1516808026-25523-90-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516808026-25523-1-git-send-email-yliu@fridaylinux.org> References: <1516808026-25523-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'net/bnxt: fix duplicate pattern for 5tuple filter' has been queued to LTS release 17.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jan 2018 15:39:54 -0000 Hi, FYI, your patch has been queued to LTS release 17.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 01/26/18. So please shout if anyone has objections. Thanks. --yliu --- >>From e4306449fde5465a8806f304044c477a4111f86f Mon Sep 17 00:00:00 2001 From: Somnath Kotur Date: Mon, 8 Jan 2018 12:24:35 -0800 Subject: [PATCH] net/bnxt: fix duplicate pattern for 5tuple filter [ upstream commit ba09f838464db72d5c6b6589f84f6a465e5594b1 ] When user re-issues same 5 tuple filter pattern cmd with different destination queue, it would flag it as an existing match. However, when deletion on this filter was attempted, it would crash as the 'vnic' from which the filter was being removed from would be different. Fix by updating the filter in the scenario where there is a pattern match and only the destination queue varies. Fixes: b7435d660a8c ("net/bnxt: add ntuple filtering support") Signed-off-by: Somnath Kotur Signed-off-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 5f0aae4..99242c4 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1956,7 +1956,8 @@ parse_ntuple_filter(struct bnxt *bp, static struct bnxt_filter_info* bnxt_match_ntuple_filter(struct bnxt *bp, - struct bnxt_filter_info *bfilter) + struct bnxt_filter_info *bfilter, + struct bnxt_vnic_info **mvnic) { struct bnxt_filter_info *mfilter = NULL; int i; @@ -1975,8 +1976,11 @@ bnxt_match_ntuple_filter(struct bnxt *bp, bfilter->dst_port == mfilter->dst_port && bfilter->dst_port_mask == mfilter->dst_port_mask && bfilter->flags == mfilter->flags && - bfilter->enables == mfilter->enables) + bfilter->enables == mfilter->enables) { + if (mvnic) + *mvnic = vnic; return mfilter; + } } } return NULL; @@ -1988,7 +1992,7 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp, enum rte_filter_op filter_op) { struct bnxt_filter_info *bfilter, *mfilter, *filter1; - struct bnxt_vnic_info *vnic, *vnic0; + struct bnxt_vnic_info *vnic, *vnic0, *mvnic; int ret; if (nfilter->flags != RTE_5TUPLE_FLAGS) { @@ -2026,12 +2030,22 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp, bfilter->ethertype = 0x800; bfilter->enables |= NTUPLE_FLTR_ALLOC_INPUT_EN_ETHERTYPE; - mfilter = bnxt_match_ntuple_filter(bp, bfilter); + mfilter = bnxt_match_ntuple_filter(bp, bfilter, &mvnic); - if (mfilter != NULL && filter_op == RTE_ETH_FILTER_ADD) { - RTE_LOG(ERR, PMD, "filter exists."); + if (mfilter != NULL && filter_op == RTE_ETH_FILTER_ADD && + bfilter->dst_id == mfilter->dst_id) { + RTE_LOG(ERR, PMD, "filter exists.\n"); ret = -EEXIST; goto free_filter; + } else if (mfilter != NULL && filter_op == RTE_ETH_FILTER_ADD && + bfilter->dst_id != mfilter->dst_id) { + mfilter->dst_id = vnic->fw_vnic_id; + ret = bnxt_hwrm_set_ntuple_filter(bp, mfilter->dst_id, mfilter); + STAILQ_REMOVE(&mvnic->filter, mfilter, bnxt_filter_info, next); + STAILQ_INSERT_TAIL(&vnic->filter, mfilter, next); + RTE_LOG(ERR, PMD, "filter with matching pattern exists.\n"); + RTE_LOG(ERR, PMD, " Updated it to the new destination queue\n"); + goto free_filter; } if (mfilter == NULL && filter_op == RTE_ETH_FILTER_DELETE) { RTE_LOG(ERR, PMD, "filter doesn't exist."); @@ -2053,11 +2067,11 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp, } ret = bnxt_hwrm_clear_ntuple_filter(bp, mfilter); - STAILQ_REMOVE(&vnic->filter, mfilter, bnxt_filter_info, - next); + STAILQ_REMOVE(&vnic->filter, mfilter, bnxt_filter_info, next); bnxt_free_filter(bp, mfilter); - bfilter->fw_l2_filter_id = -1; + mfilter->fw_l2_filter_id = -1; bnxt_free_filter(bp, bfilter); + bfilter->fw_l2_filter_id = -1; } return 0; -- 2.7.4