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 EDF5D1B1BE for ; Wed, 24 Jan 2018 16:39:51 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 91E83226BA; Wed, 24 Jan 2018 10:39:51 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 24 Jan 2018 10:39:51 -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=3ulNFXNxURZcyC/Ed 43CFxgQ8t89xCiCkVC5keD6PC8=; b=PyJOl3lgdadKMtX39nTpq3RrV4ec5RT3z DqMqVpiCuezD+HoH3SZu73AeZIp47R6BPx6Naf+HUd56GQFI7Nd0EmBn7e1x9wKW bC5PZNlWm03IiXd9ba6en72wl3vjSfZyD4dmlq5pPK6DyMq4b8gHHHY4ncWIz51v WbApDKTtb0aMaHkVOQ/JnzdH3WxD0K4as4CwvhYLXFm+6althjIu3jn2LvuM/r17 SvmwA1yRM3ruZbYSFvSO0boTDx+5nXvPH7uoUElpkMfo8q5Ge0+rVf0ZskZDQQy3 syeKb+Jbe7Z0EUT9Id47HgYhuCKtSNXCYFUhf0DFxYnVqClbgY7zw== 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=3ulNFXNxURZcyC/Ed43CFxgQ8t89xCiCkVC5keD6PC8=; b=F05wUm+M NvLYc/CfolJpPz8Mos7d6Z6wlAvCjTQSCapAO92JApHH/GNNTOl8vE/6yGrFlS2b /9/kGZ8oU5JD5q8fJ2PdUJl5OlFgi5Eb+M54ntpAj7EGaKADGyP1hBtDx9epkQrG q+XdValmL0oT0dDiOVQwxiKZtKkEQpaaXVGf+J7L/QlANw+O60cfW52Y3Gu1dt2a pU+ANk6iSQ/TPt3jC3xgyAkOi0Kjwgeycji84oEMl6o2cMXqQ5liiZxOU9SWpmGy WjzC9U/MNg7wfcLv69PcQqdHUUjHceRUnEnKnqHG3VdBPGha3Wq9PfBqqah8jFtC hKUpUxV1sc0o7A== X-ME-Sender: Received: from localhost.localdomain (unknown [115.150.27.206]) by mail.messagingengine.com (Postfix) with ESMTPA id 7C81A7E1BE; Wed, 24 Jan 2018 10:39:49 -0500 (EST) From: Yuanhan Liu To: Somnath Kotur Cc: Ajit Khaparde , dpdk stable Date: Wed, 24 Jan 2018 23:32:37 +0800 Message-Id: <1516808026-25523-89-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 filter pattern creation error' 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:52 -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 94859d52f3f5aa3f55a2c5401c511a587228faaf Mon Sep 17 00:00:00 2001 From: Somnath Kotur Date: Mon, 8 Jan 2018 12:24:34 -0800 Subject: [PATCH] net/bnxt: fix duplicate filter pattern creation error [ upstream commit 46667f9377ffcb48af3c6d8998dd4bc6df8436f5 ] If the attribute/pattern for a flow is the same, with only the 'action' i.e the destination queue index changing, allow it by cleaning up the older ntuple filter and updating the existing flow with the new filter rule having the new destination queue ID. Also, clear the L2 filter during flow_destroy after destroying the ntuple filter, otherwise the flow record is not completely purged from the HW. Fixes: 5ef3b79fdfe6 ("net/bnxt: support flow filter ops") Signed-off-by: Somnath Kotur Signed-off-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_filter.c | 42 +++++++++++++++++++++++++++++++++++++----- drivers/net/bnxt/bnxt_hwrm.c | 1 - 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c index 65d30fb..32af606 100644 --- a/drivers/net/bnxt/bnxt_filter.c +++ b/drivers/net/bnxt/bnxt_filter.c @@ -1042,8 +1042,23 @@ bnxt_match_filter(struct bnxt *bp, struct bnxt_filter_info *nf) !memcmp(mf->dst_ipaddr, nf->dst_ipaddr, sizeof(nf->dst_ipaddr)) && !memcmp(mf->dst_ipaddr_mask, nf->dst_ipaddr_mask, - sizeof(nf->dst_ipaddr_mask))) - return -EEXIST; + sizeof(nf->dst_ipaddr_mask))) { + if (mf->dst_id == nf->dst_id) + return -EEXIST; + /* Same Flow, Different queue + * Clear the old ntuple filter + */ + if (nf->filter_type == HWRM_CFA_EM_FILTER) + bnxt_hwrm_clear_em_filter(bp, mf); + if (nf->filter_type == HWRM_CFA_NTUPLE_FILTER) + bnxt_hwrm_clear_ntuple_filter(bp, mf); + /* Free the old filter, update flow + * with new filter + */ + bnxt_free_filter(bp, mf); + flow->filter = nf; + return -EXDEV; + } } } return 0; @@ -1059,6 +1074,7 @@ bnxt_flow_create(struct rte_eth_dev *dev, struct bnxt *bp = (struct bnxt *)dev->data->dev_private; struct bnxt_filter_info *filter; struct bnxt_vnic_info *vnic = NULL; + bool update_flow = false; struct rte_flow *flow; unsigned int i; int ret = 0; @@ -1089,9 +1105,17 @@ bnxt_flow_create(struct rte_eth_dev *dev, goto free_filter; ret = bnxt_match_filter(bp, filter); - if (ret != 0) { + if (ret == -EEXIST) { RTE_LOG(DEBUG, PMD, "Flow already exists.\n"); + /* Clear the filter that was created as part of + * validate_and_parse_flow() above + */ + bnxt_hwrm_clear_l2_filter(bp, filter); goto free_filter; + } else if (ret == -EXDEV) { + RTE_LOG(DEBUG, PMD, "Flow with same pattern exists"); + RTE_LOG(DEBUG, PMD, "Updating with different destination\n"); + update_flow = true; } if (filter->filter_type == HWRM_CFA_EM_FILTER) { @@ -1114,22 +1138,29 @@ bnxt_flow_create(struct rte_eth_dev *dev, if (!ret) { flow->filter = filter; flow->vnic = vnic; + if (update_flow) { + ret = -EXDEV; + goto free_flow; + } RTE_LOG(ERR, PMD, "Successfully created flow.\n"); STAILQ_INSERT_TAIL(&vnic->flow_list, flow, next); return flow; } free_filter: - filter->fw_l2_filter_id = -1; bnxt_free_filter(bp, filter); free_flow: if (ret == -EEXIST) rte_flow_error_set(error, ret, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "Matching Flow exists."); + else if (ret == -EXDEV) + rte_flow_error_set(error, ret, + RTE_FLOW_ERROR_TYPE_HANDLE, NULL, + "Flow with pattern exists, updating destination queue"); else rte_flow_error_set(error, -ret, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, - "Failed to create flow."); + "Failed to create flow."); rte_free(flow); flow = NULL; return flow; @@ -1153,6 +1184,7 @@ bnxt_flow_destroy(struct rte_eth_dev *dev, if (filter->filter_type == HWRM_CFA_NTUPLE_FILTER) ret = bnxt_hwrm_clear_ntuple_filter(bp, filter); + bnxt_hwrm_clear_l2_filter(bp, filter); if (!ret) { STAILQ_REMOVE(&vnic->flow_list, flow, rte_flow, next); rte_free(flow); diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 564e3f7..3b93bb5 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -3569,7 +3569,6 @@ int bnxt_hwrm_clear_ntuple_filter(struct bnxt *bp, HWRM_UNLOCK(); filter->fw_ntuple_filter_id = -1; - filter->fw_l2_filter_id = -1; return 0; } -- 2.7.4