From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 605B32E83 for ; Mon, 9 Nov 2015 20:21:25 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 09 Nov 2015 11:21:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,266,1444719600"; d="scan'208";a="681609006" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 09 Nov 2015 11:21:22 -0800 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id tA9JLMBt010671; Mon, 9 Nov 2015 19:21:22 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id tA9JLLHa008404; Mon, 9 Nov 2015 19:21:21 GMT Received: (from kananye1@localhost) by sivswdev01.ir.intel.com with id tA9JLLJ2008400; Mon, 9 Nov 2015 19:21:21 GMT From: Konstantin Ananyev To: dev@dpdk.org Date: Mon, 9 Nov 2015 19:21:13 +0000 Message-Id: <1447096873-8353-3-git-send-email-konstantin.ananyev@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1447096873-8353-1-git-send-email-konstantin.ananyev@intel.com> References: <1447096873-8353-1-git-send-email-konstantin.ananyev@intel.com> In-Reply-To: <1440085070-13989-1-git-send-email-vladz@cloudius-systems.com> References: <1440085070-13989-1-git-send-email-vladz@cloudius-systems.com> Subject: [dpdk-dev] [PATCHv6 2/2] ixgbe: fix TX hang when RS distance exceeds HW limit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2015 19:21:26 -0000 One of the ways to reproduce the issue: testpmd -- -i --txqflags=0 testpmd> set fwd txonly testpmd> set txpkts 64,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 testpmd> set txsplit rand testpmd> start After some time TX on ixgbe queue will hang, and all packet transmission on that queue will stop. This bug was first reported and investigated by Vlad Zolotarov : "We can reproduce this issue when stressed the xmit path with a lot of highly fragmented TCP frames (packets with up to 33 fragments with non-headers fragments as small as 4 bytes) with all offload features enabled." The root cause is that ixgbe_xmit_pkts() in some cases violates the HW rule that the distance between TDs with RS bit set should not exceed 40 TDs. >>From the latest 82599 spec update: "When WTHRESH is set to zero, the software device driver should set the RS bit in the Tx descriptors with the EOP bit set and at least once in the 40 descriptors." The fix is to make sure that the distance between TDs with RS bit set would never exceed HW limit. As part of that fix, tx_rs_thresh for ixgbe PMD is not allowed to be greater then to 32 to comply with HW restrictions. With that fix slight slowdown for the full-featured ixgbe TX path might be observed (from our testing - up to 4%). ixgbe simple TX path is unaffected by that patch. v5 changes: - rework the patch to avoid setting RS bit on every EOP descriptor (while that approach is valid, it causes significant slowdown on the TX path: up to 25%). v6 changes: - fix pmd_perf_autotest - fix error description - update RN Reported-by: Vlad Zolotarov Signed-off-by: Konstantin Ananyev --- app/test/test_pmd_perf.c | 8 ++++---- doc/guides/rel_notes/release_2_2.rst | 7 +++++++ drivers/net/ixgbe/ixgbe_rxtx.c | 32 +++++++++++++++++++++++++++----- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 1fd6843..ef9262c 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -841,10 +841,10 @@ test_set_rxtx_conf(cmdline_fixed_string_t mode) port_conf.rxmode.enable_scatter = 0; return 0; } else if (!strcmp(mode, "scalar")) { - /* bulk alloc rx, simple tx */ - tx_conf.txq_flags = 0xf01; - tx_conf.tx_rs_thresh = 128; - tx_conf.tx_free_thresh = 128; + /* bulk alloc rx, full-featured tx */ + tx_conf.txq_flags = 0; + tx_conf.tx_rs_thresh = 32; + tx_conf.tx_free_thresh = 32; port_conf.rxmode.hw_ip_checksum = 1; port_conf.rxmode.enable_scatter = 0; return 0; diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst index 59dda59..62e225b 100644 --- a/doc/guides/rel_notes/release_2_2.rst +++ b/doc/guides/rel_notes/release_2_2.rst @@ -134,6 +134,13 @@ Drivers VF needs the PF interrupt support initialized even if not started. +* **ixgbe: Fixed TX hang when RS distance exceeds HW limit.** + + Fixed an issue when TX queue can hang when a lot of highly fragmented + packets have to be sent. + As part of that fix, tx_rs_thresh for ixgbe PMD is not allowed to be greater + then to 32 to comply with HW restrictions. + * **i40e: Fixed base driver allocation when not using first numa node.** Fixed i40e issue that occurred when a DPDK application didn't initialize diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 5561195..ca6fb69 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -572,7 +572,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, struct ixgbe_tx_entry *sw_ring; struct ixgbe_tx_entry *txe, *txn; volatile union ixgbe_adv_tx_desc *txr; - volatile union ixgbe_adv_tx_desc *txd; + volatile union ixgbe_adv_tx_desc *txd, *txp; struct rte_mbuf *tx_pkt; struct rte_mbuf *m_seg; uint64_t buf_dma_addr; @@ -595,6 +595,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, txr = txq->tx_ring; tx_id = txq->tx_tail; txe = &sw_ring[tx_id]; + txp = NULL; /* Determine if the descriptor ring needs to be cleaned. */ if (txq->nb_tx_free < txq->tx_free_thresh) @@ -638,6 +639,12 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, */ nb_used = (uint16_t)(tx_pkt->nb_segs + new_ctx); + if (txp != NULL && + nb_used + txq->nb_tx_used >= txq->tx_rs_thresh) + /* set RS on the previous packet in the burst */ + txp->read.cmd_type_len |= + rte_cpu_to_le_32(IXGBE_TXD_CMD_RS); + /* * The number of descriptors that must be allocated for a * packet is the number of segments of that packet, plus 1 @@ -840,10 +847,18 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, /* Update txq RS bit counters */ txq->nb_tx_used = 0; - } + txp = NULL; + } else + txp = txd; + txd->read.cmd_type_len |= rte_cpu_to_le_32(cmd_type_len); } + end_of_tx: + /* set RS on last packet in the burst */ + if (txp != NULL) + txp->read.cmd_type_len |= rte_cpu_to_le_32(IXGBE_TXD_CMD_RS); + rte_wmb(); /* @@ -2019,9 +2034,16 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, tx_conf->tx_free_thresh : DEFAULT_TX_FREE_THRESH); if (tx_rs_thresh >= (nb_desc - 2)) { PMD_INIT_LOG(ERR, "tx_rs_thresh must be less than the number " - "of TX descriptors minus 2. (tx_rs_thresh=%u " - "port=%d queue=%d)", (unsigned int)tx_rs_thresh, - (int)dev->data->port_id, (int)queue_idx); + "of TX descriptors minus 2. (tx_rs_thresh=%u " + "port=%d queue=%d)", (unsigned int)tx_rs_thresh, + (int)dev->data->port_id, (int)queue_idx); + return -(EINVAL); + } + if (tx_rs_thresh > DEFAULT_TX_RS_THRESH) { + PMD_INIT_LOG(ERR, "tx_rs_thresh must be less or equal than %u. " + "(tx_rs_thresh=%u port=%d queue=%d)", + DEFAULT_TX_RS_THRESH, (unsigned int)tx_rs_thresh, + (int)dev->data->port_id, (int)queue_idx); return -(EINVAL); } if (tx_free_thresh >= (nb_desc - 3)) { -- 1.8.3.1