From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 9EFF2A0096 for ; Fri, 12 Apr 2019 03:48:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2E3AF5689; Fri, 12 Apr 2019 03:48:32 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 022EF4F94; Fri, 12 Apr 2019 03:48:23 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x3C1jcHY004288; Thu, 11 Apr 2019 18:48:23 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=FyKlEK/rt4nPuuU4bgbwkuv8xnlfa98D+Q1l78rtqwM=; b=dVews9aJ8UIYrAdsxRuDRos9fv0XugCvCneYUzz8yP90PNUXLwHDzcJFW95Ab9eiXmQp wMcH6OQAotfwkbbUdmRODzDp9NJz5wXJFvtycX9Ml49fhS7D6CiOdFZjrzD6sPXghULe JwNcwVYRAZ7FRPaDO/eI9swUJny8wNffRJRkegapX6IdTNKt/qQgioPV8KVuHzlNEzWT rzgnpCLPNsl0awFwfuaAIde5GVMBoO/SP1QHFaryqc+i+5AH8xLr+hD3iGoX4sFIvK64 4kjxhEgIzdttIwVsQs4ZPcZtB7ah9Vb/Kwkir8rJ1INsAVeBz1Yj1Z43pPo7BecQklRA qw== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2rt7b8j6y8-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 11 Apr 2019 18:48:23 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 11 Apr 2019 18:48:21 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 11 Apr 2019 18:48:21 -0700 Received: from irv1user08.caveonetworks.com (unknown [10.104.116.105]) by maili.marvell.com (Postfix) with ESMTP id 902653F7043; Thu, 11 Apr 2019 18:48:21 -0700 (PDT) Received: (from rmody@localhost) by irv1user08.caveonetworks.com (8.14.4/8.14.4/Submit) id x3C1mLgu023002; Thu, 11 Apr 2019 18:48:21 -0700 X-Authentication-Warning: irv1user08.caveonetworks.com: rmody set sender to rmody@marvell.com using -f From: Rasesh Mody To: CC: Shahed Shaikh , , , Date: Thu, 11 Apr 2019 18:47:40 -0700 Message-ID: <1555033662-22935-4-git-send-email-rmody@marvell.com> X-Mailer: git-send-email 1.7.10.3 In-Reply-To: <1555033662-22935-1-git-send-email-rmody@marvell.com> References: <1555033662-22935-1-git-send-email-rmody@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-04-12_01:, , signatures=0 Subject: [dpdk-dev] [PATCH 4/6] net/bnx2x: fix DMAE timeout 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" Message-ID: <20190412014740.HqxPghSqZAJSYk8-Gyah-z-souNNTGKvWenjIna7ToM@z> From: Shahed Shaikh In some cases, DPKD application may send packets while PMD is going through load or unload flow. This causes firmware to access invalid/unallocated memory to process transmit buffer. Which results in error on PCI bus and chip further blocks access to host, causing a DMAE timeout. Fix this issue by installing dummy empty transmit and receive handlers at the beginning of unload path (rte_eth_dev_stop()) and install actual transmit and receive handlers after successful load of the PMD port (rte_eth_dev_start()). This way, application won't be able to send packets while device is going through load/unload flow. Fixes: 540a211084a7 ("bnx2x: driver core") Cc: stable@dpdk.org Signed-off-by: Shahed Shaikh --- drivers/net/bnx2x/bnx2x_ethdev.c | 9 ++++----- drivers/net/bnx2x/bnx2x_rxtx.c | 21 ++++++++++++++++----- drivers/net/bnx2x/bnx2x_rxtx.h | 3 ++- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index bcb899a..f85766c 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -213,6 +213,7 @@ void bnx2x_periodic_stop(void *param) return -ENXIO; } + bnx2x_dev_rxtx_init_dummy(dev); return 0; } @@ -242,11 +243,7 @@ void bnx2x_periodic_stop(void *param) PMD_DRV_LOG(ERR, sc, "rte_intr_enable failed"); } - ret = bnx2x_dev_rx_init(dev); - if (ret != 0) { - PMD_DRV_LOG(DEBUG, sc, "bnx2x_dev_rx_init returned error code"); - return -3; - } + bnx2x_dev_rxtx_init(dev); bnx2x_print_device_info(sc); @@ -261,6 +258,8 @@ void bnx2x_periodic_stop(void *param) PMD_INIT_FUNC_TRACE(sc); + bnx2x_dev_rxtx_init_dummy(dev); + if (IS_PF(sc)) { rte_intr_disable(&sc->pci_dev->intr_handle); rte_intr_callback_unregister(&sc->pci_dev->intr_handle, diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c index ca28aac..e5a2b25 100644 --- a/drivers/net/bnx2x/bnx2x_rxtx.c +++ b/drivers/net/bnx2x/bnx2x_rxtx.c @@ -311,7 +311,6 @@ txq->tx_bd_tail = 0; txq->tx_bd_head = 0; txq->nb_tx_avail = txq->nb_tx_desc; - dev->tx_pkt_burst = bnx2x_xmit_pkts; dev->data->tx_queues[queue_idx] = txq; if (!sc->tx_queues) sc->tx_queues = dev->data->tx_queues; @@ -441,14 +440,26 @@ return nb_rx; } -int -bnx2x_dev_rx_init(struct rte_eth_dev *dev) +static uint16_t +bnx2x_rxtx_pkts_dummy(__rte_unused void *p_rxq, + __rte_unused struct rte_mbuf **rx_pkts, + __rte_unused uint16_t nb_pkts) { - dev->rx_pkt_burst = bnx2x_recv_pkts; - return 0; } +void bnx2x_dev_rxtx_init_dummy(struct rte_eth_dev *dev) +{ + dev->rx_pkt_burst = bnx2x_rxtx_pkts_dummy; + dev->tx_pkt_burst = bnx2x_rxtx_pkts_dummy; +} + +void bnx2x_dev_rxtx_init(struct rte_eth_dev *dev) +{ + dev->rx_pkt_burst = bnx2x_recv_pkts; + dev->tx_pkt_burst = bnx2x_xmit_pkts; +} + void bnx2x_dev_clear_queues(struct rte_eth_dev *dev) { diff --git a/drivers/net/bnx2x/bnx2x_rxtx.h b/drivers/net/bnx2x/bnx2x_rxtx.h index 6ad4928..3f4692b 100644 --- a/drivers/net/bnx2x/bnx2x_rxtx.h +++ b/drivers/net/bnx2x/bnx2x_rxtx.h @@ -74,7 +74,8 @@ int bnx2x_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id, void bnx2x_dev_rx_queue_release(void *rxq); void bnx2x_dev_tx_queue_release(void *txq); -int bnx2x_dev_rx_init(struct rte_eth_dev *dev); +void bnx2x_dev_rxtx_init(struct rte_eth_dev *dev); +void bnx2x_dev_rxtx_init_dummy(struct rte_eth_dev *dev); void bnx2x_dev_clear_queues(struct rte_eth_dev *dev); #endif /* _BNX2X_RXTX_H_ */ -- 1.7.10.3