From patchwork Sat Mar 26 00:43:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "John Daley (johndale)" X-Patchwork-Id: 11742 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 73AC358ED; Sat, 26 Mar 2016 01:43:47 +0100 (CET) Received: from rcdn-iport-8.cisco.com (rcdn-iport-8.cisco.com [173.37.86.79]) by dpdk.org (Postfix) with ESMTP id 9034C58DF for ; Sat, 26 Mar 2016 01:43:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2850; q=dns/txt; s=iport; t=1458953025; x=1460162625; h=from:to:cc:subject:date:message-id; bh=ilxihhgNb5LckLuoNE7bjUTLUfu98ghEiWUaeU636gM=; b=NngZ8p3r+NtrawjKiSgSHnBswPbiAXaudOMVZn3CFghTHeOEIxralv/k VQf7CCLGqqT+bmtJFVUBQBl7zuJLytPs1qMgUaamKemC5OsF+0xLtytWN fQAccrxVPTZsFH4fcy6PV+Dr4w9gZdOmx60N1pu4Aoi8abh4yFzHppyZ/ Q=; X-IronPort-AV: E=Sophos;i="5.24,393,1454976000"; d="scan'208";a="84960483" Received: from alln-core-9.cisco.com ([173.36.13.129]) by rcdn-iport-8.cisco.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 26 Mar 2016 00:43:44 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by alln-core-9.cisco.com (8.14.5/8.14.5) with ESMTP id u2Q0hi32018810; Sat, 26 Mar 2016 00:43:44 GMT Received: by cisco.com (Postfix, from userid 392789) id 4456C3FAADBD; Fri, 25 Mar 2016 17:43:44 -0700 (PDT) From: John Daley To: dev@dpdk.org Cc: John Daley Date: Fri, 25 Mar 2016 17:43:27 -0700 Message-Id: <1458953007-11129-1-git-send-email-johndale@cisco.com> X-Mailer: git-send-email 2.7.0 Subject: [dpdk-dev] [PATCH] enic: fix TX hang when number of packets > queue size 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" If the nb_pkts parameter to rte_eth_tx_burst() was greater than the TX descriptor count, a completion was not being requested from the NIC, so descriptors would not be released back to the host causing a lock-up. Introduce a limit of how many TX descriptors can be used in a single call to the enic PMD burst TX function before requesting a completion. Fixes: d739ba4c6abf ("enic: improve Tx packet rate") Signed-off-by: John Daley --- drivers/net/enic/enic_ethdev.c | 20 ++++++++++++++++---- drivers/net/enic/enic_res.h | 1 + 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 4969476..6bea940 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -523,7 +523,7 @@ static void enicpmd_remove_mac_addr(struct rte_eth_dev *eth_dev, __rte_unused ui static uint16_t enicpmd_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { - unsigned int index; + uint16_t index; unsigned int frags; unsigned int pkt_len; unsigned int seg_len; @@ -535,6 +535,7 @@ static uint16_t enicpmd_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, unsigned short vlan_id; unsigned short ol_flags; uint8_t last_seg, eop; + unsigned int host_tx_descs = 0; for (index = 0; index < nb_pkts; index++) { tx_pkt = *tx_pkts++; @@ -550,6 +551,7 @@ static uint16_t enicpmd_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, return index; } } + pkt_len = tx_pkt->pkt_len; vlan_id = tx_pkt->vlan_tci; ol_flags = tx_pkt->ol_flags; @@ -559,9 +561,19 @@ static uint16_t enicpmd_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, next_tx_pkt = tx_pkt->next; seg_len = tx_pkt->data_len; inc_len += seg_len; - eop = (pkt_len == inc_len) || (!next_tx_pkt); - last_seg = eop && - (index == ((unsigned int)nb_pkts - 1)); + + host_tx_descs++; + last_seg = 0; + eop = 0; + if ((pkt_len == inc_len) || !next_tx_pkt) { + eop = 1; + /* post if last packet in batch or > thresh */ + if ((index == (nb_pkts - 1)) || + (host_tx_descs > ENIC_TX_POST_THRESH)) { + last_seg = 1; + host_tx_descs = 0; + } + } enic_send_pkt(enic, wq, tx_pkt, (unsigned short)seg_len, !frags, eop, last_seg, ol_flags, vlan_id); tx_pkt = next_tx_pkt; diff --git a/drivers/net/enic/enic_res.h b/drivers/net/enic/enic_res.h index 33f2e84..00fa71d 100644 --- a/drivers/net/enic/enic_res.h +++ b/drivers/net/enic/enic_res.h @@ -53,6 +53,7 @@ #define ENIC_NON_TSO_MAX_DESC 16 #define ENIC_DEFAULT_RX_FREE_THRESH 32 +#define ENIC_TX_POST_THRESH (ENIC_MIN_WQ_DESCS / 2) #define ENIC_SETTING(enic, f) ((enic->config.flags & VENETF_##f) ? 1 : 0)