From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk0-f66.google.com (mail-vk0-f66.google.com [209.85.213.66]) by dpdk.org (Postfix) with ESMTP id A3D07475E for ; Mon, 28 Mar 2016 22:52:18 +0200 (CEST) Received: by mail-vk0-f66.google.com with SMTP id e6so16778504vkh.1 for ; Mon, 28 Mar 2016 13:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=huyFzLHvBqYwLQr2ObmiSdfg19wsRRbKFAOm2H7Gyqo=; b=U5bMQCMQEeILFpR0oHka2LjPscgPhY23++QMcUlG2h3zz6zcU6cX7aJdlkyTViOwgf SD59QxKhMT7Dprm3Vw3jQlAKeXlCeqbigpYt70naZgyliL8qwbBJKC9rsAaVufmdTLbE 48L1GWeO0rRBD2tm7tBosbOtdWaPJOm8rtgjmOXKYP8jh+Xamc9WsaQ3op7U9evclG9F cSpIL1MAZefhXhhHJpZa+wY+um5rWbDNhax0VKyVLN3IqStLUfFvoFFwr5vWYoaIlOM4 qGqxPhQOeGX9JOIc3PeOuns0Dihu8HED86S4O07gXJqcaZRMzObvLz12rWVXHbyXAGpS 4w5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=huyFzLHvBqYwLQr2ObmiSdfg19wsRRbKFAOm2H7Gyqo=; b=ZtwbXn/dGwp0uTSE6wg2+PEeUNKrYYbBgl5tY3v8jCNVvGLMBMVTgBz9qKPSemjSbt TRABTrTkmaN2fm55YanGOrM9Y4gy66UVDvY+BIjtn1THvQaD/YKiWJshGuh0JdA4o7Mw BEcdELjmsKjxloMgG39nFakaA87xiwQQOlBkKK+Z0+h5UWYLAh0uhlJdba7VvAd6Wj9u n5FGC0LmGhjEy6s5MrQqIlu6nLWZltECmd5dejE1UedlNpCoSwr857MFIAcuTqQyhmo8 4lMTvobebnv+B0TtLD0eGVCTBFDHliT8iIOpO1NEGYbeRJXkcHeR/VfVdfUddLSRsQUe GpPw== X-Gm-Message-State: AD7BkJIBS7/JPfIpjivQg67AcPEVFhCgKe3NcyTSsGsED4G1+1ZufjL+QNf3jKgR2HM/WQ== X-Received: by 10.159.37.150 with SMTP id 22mr12208710uaf.36.1459198338222; Mon, 28 Mar 2016 13:52:18 -0700 (PDT) Received: from localhost.localdomain ([23.79.237.14]) by smtp.gmail.com with ESMTPSA id v19sm4301389vkd.22.2016.03.28.13.52.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Mar 2016 13:52:17 -0700 (PDT) From: Robert Sanford X-Google-Original-From: Robert Sanford To: dev@dpdk.org, cristian.dumitrescu@intel.com Date: Mon, 28 Mar 2016 16:51:37 -0400 Message-Id: <1459198297-49854-5-git-send-email-rsanford@akamai.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1459198297-49854-1-git-send-email-rsanford@akamai.com> References: <1459198297-49854-1-git-send-email-rsanford@akamai.com> Subject: [dpdk-dev] [PATCH 4/4] port: fix ethdev writer burst too big 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, 28 Mar 2016 20:52:19 -0000 For f_tx_bulk functions in rte_port_ethdev.c, we may unintentionally send bursts larger than tx_burst_sz to the underlying ethdev. Some PMDs (e.g., ixgbe) may truncate this request to their maximum burst size, resulting in unnecessary enqueuing failures or ethdev writer retries. We propose to fix this by moving the tx buffer flushing logic from *after* the loop that puts all packets into the tx buffer, to *inside* the loop, testing for a full burst when adding each packet. Signed-off-by: Robert Sanford --- lib/librte_port/rte_port_ethdev.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/librte_port/rte_port_ethdev.c b/lib/librte_port/rte_port_ethdev.c index 3fb4947..1283338 100644 --- a/lib/librte_port/rte_port_ethdev.c +++ b/lib/librte_port/rte_port_ethdev.c @@ -151,7 +151,7 @@ static int rte_port_ethdev_reader_stats_read(void *port, struct rte_port_ethdev_writer { struct rte_port_out_stats stats; - struct rte_mbuf *tx_buf[2 * RTE_PORT_IN_BURST_SIZE_MAX]; + struct rte_mbuf *tx_buf[RTE_PORT_IN_BURST_SIZE_MAX]; uint32_t tx_burst_sz; uint16_t tx_buf_count; uint64_t bsz_mask; @@ -257,11 +257,11 @@ rte_port_ethdev_writer_tx_bulk(void *port, p->tx_buf[tx_buf_count++] = pkt; RTE_PORT_ETHDEV_WRITER_STATS_PKTS_IN_ADD(p, 1); pkts_mask &= ~pkt_mask; - } - p->tx_buf_count = tx_buf_count; - if (tx_buf_count >= p->tx_burst_sz) - send_burst(p); + p->tx_buf_count = tx_buf_count; + if (tx_buf_count >= p->tx_burst_sz) + send_burst(p); + } } return 0; @@ -328,7 +328,7 @@ static int rte_port_ethdev_writer_stats_read(void *port, struct rte_port_ethdev_writer_nodrop { struct rte_port_out_stats stats; - struct rte_mbuf *tx_buf[2 * RTE_PORT_IN_BURST_SIZE_MAX]; + struct rte_mbuf *tx_buf[RTE_PORT_IN_BURST_SIZE_MAX]; uint32_t tx_burst_sz; uint16_t tx_buf_count; uint64_t bsz_mask; @@ -466,11 +466,11 @@ rte_port_ethdev_writer_nodrop_tx_bulk(void *port, p->tx_buf[tx_buf_count++] = pkt; RTE_PORT_ETHDEV_WRITER_NODROP_STATS_PKTS_IN_ADD(p, 1); pkts_mask &= ~pkt_mask; - } - p->tx_buf_count = tx_buf_count; - if (tx_buf_count >= p->tx_burst_sz) - send_burst_nodrop(p); + p->tx_buf_count = tx_buf_count; + if (tx_buf_count >= p->tx_burst_sz) + send_burst_nodrop(p); + } } return 0; -- 1.7.1