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 1B5CE237 for ; Tue, 21 Nov 2017 14:22:58 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id C3BD220B1F; Tue, 21 Nov 2017 08:22:57 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Tue, 21 Nov 2017 08:22:57 -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=IJwawEoueSklJWM7M MGkJNjMDvxb+d1hElUWad0vwFk=; b=KFCEaQzBTgU2NjGBwi3cc2dNqdbQH3Xt0 apTRxVnMacSlIH+1zprsJZQice40+VmQCd6Prw2M06VGmEYDjNcZDYgMQQeUgU2S +MQoaz6pUGdg3lxLVhCAMJVe/M6jH/fNTL1M6POK5Qu+VVFL7/uITomtOhLdFT87 /rjJqseZSP9tcQmOu1DgoxHIKGUv9Hf/dLQE+3BgOUnzGtCDLDqlIS7/W6xYT/zK /b2Myr/jD+YewJmogHncC2zf0W+5x07w6ZYHSR/xW0AM647nzYHIhZ4Re1KM01IU m4ubk6/zooZoSNL0MBl05YNbWU5+44LoPP28qOwt9zbbcAgo60AaA== 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=IJwawEoueSklJWM7MMGkJNjMDvxb+d1hElUWad0vwFk=; b=lcIHueyq CbpQj5T676r4cqeGqUiesB1uKDnUklrNT1EIbv6I3fEvZB/DHk0poV6hivJtR4DO LBKlJQUr/1oGy3bgxZkmijr51+Hdj/cl5USwgSvUEPLp6TvmVgw5U0stoNy9zEn4 gIXMIBmR1Z1TvfTDWtYIQoCP5x1BF9YWLklw5hE/aRPd1+eWaNB6hnHvtz2/k63h dWUboMoFOL1iy7ReNU7kOUIVx3ZIxFXIw6kUA3GZD0iYokd8Mt0NF+pWoa6c92Dw VfPUgV0mHqd1aaDtsih3PlL7cB4VMbJaQM9X/6j0Nq2H/PrOpAU6oU00DDj5fRSF e37AR7UBHG/DzQ== X-ME-Sender: Received: from localhost.localdomain (unknown [180.158.62.0]) by mail.messagingengine.com (Postfix) with ESMTPA id 32E40243B9; Tue, 21 Nov 2017 08:22:53 -0500 (EST) From: Yuanhan Liu To: Wei Dai Cc: Lijuan Tu , Jingjing Wu , dpdk stable Date: Tue, 21 Nov 2017 21:16:36 +0800 Message-Id: <1511270333-31002-54-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511270333-31002-1-git-send-email-yliu@fridaylinux.org> References: <1511270333-31002-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'net/i40e: fix mirror rule reset when port is closed' has been queued to stable release 17.08.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: Tue, 21 Nov 2017 13:22:58 -0000 Hi, FYI, your patch has been queued to stable release 17.08.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 11/24/17. So please shout if anyone has objections. Thanks. --yliu --- >>From ac2dda01421785c2185750a6a52c8a0f83ec29e6 Mon Sep 17 00:00:00 2001 From: Wei Dai Date: Mon, 25 Sep 2017 14:36:53 +0800 Subject: [PATCH] net/i40e: fix mirror rule reset when port is closed [ upstream commit 77a45aeb6b2b4f8dbf8ca53e8bfae8aa18382157 ] When an i40e PF port is stopped, all mirror rules should be reserved. But when an i40e PF port is closed, all mirror rules should be removed. When a mirror rule is removed, its associated hardware and software resource should also be removed. Fixes: a4def5edf0fc ("i40e: enable port mirroring") Signed-off-by: Wei Dai Tested-by: Lijuan Tu Acked-by: Jingjing Wu --- drivers/net/i40e/i40e_ethdev.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 62f25b3..1adc8c8 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -360,6 +360,12 @@ static int i40e_dev_sync_phy_type(struct i40e_hw *hw); static void i40e_configure_registers(struct i40e_hw *hw); static void i40e_hw_init(struct rte_eth_dev *dev); static int i40e_config_qinq(struct i40e_hw *hw, struct i40e_vsi *vsi); +static enum i40e_status_code i40e_aq_del_mirror_rule(struct i40e_hw *hw, + uint16_t seid, + uint16_t rule_type, + uint16_t *entries, + uint16_t count, + uint16_t rule_id); static int i40e_mirror_rule_set(struct rte_eth_dev *dev, struct rte_eth_mirror_conf *mirror_conf, uint8_t sw_id, uint8_t on); @@ -2069,7 +2075,6 @@ i40e_dev_stop(struct rte_eth_dev *dev) struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct i40e_vsi *main_vsi = pf->main_vsi; - struct i40e_mirror_rule *p_mirror; struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; int i; @@ -2098,13 +2103,6 @@ i40e_dev_stop(struct rte_eth_dev *dev) /* Set link down */ i40e_dev_set_link_down(dev); - /* Remove all mirror rules */ - while ((p_mirror = TAILQ_FIRST(&pf->mirror_list))) { - TAILQ_REMOVE(&pf->mirror_list, p_mirror, rules); - rte_free(p_mirror); - } - pf->nb_mirror_rule = 0; - if (!rte_intr_allow_others(intr_handle)) /* resume to the default handler */ rte_intr_callback_register(intr_handle, @@ -2131,12 +2129,34 @@ i40e_dev_close(struct rte_eth_dev *dev) struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; + struct i40e_mirror_rule *p_mirror; uint32_t reg; int i; + int ret; PMD_INIT_FUNC_TRACE(); i40e_dev_stop(dev); + + /* Remove all mirror rules */ + while ((p_mirror = TAILQ_FIRST(&pf->mirror_list))) { + ret = i40e_aq_del_mirror_rule(hw, + pf->main_vsi->veb->seid, + p_mirror->rule_type, + p_mirror->entries, + p_mirror->num_entries, + p_mirror->id); + if (ret < 0) + PMD_DRV_LOG(ERR, "failed to remove mirror rule: " + "status = %d, aq_err = %d.", ret, + hw->aq.asq_last_status); + + /* remove mirror software resource anyway */ + TAILQ_REMOVE(&pf->mirror_list, p_mirror, rules); + rte_free(p_mirror); + pf->nb_mirror_rule--; + } + i40e_dev_free_queues(dev); /* Disable interrupt */ -- 2.7.4