From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f48.google.com (mail-lf0-f48.google.com [209.85.215.48]) by dpdk.org (Postfix) with ESMTP id 192D06CB8 for ; Sat, 29 Oct 2016 03:06:46 +0200 (CEST) Received: by mail-lf0-f48.google.com with SMTP id f134so63347983lfg.2 for ; Fri, 28 Oct 2016 18:06:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+MzaSrYO2WgC3Qcmfm7BGX2pGBB+hpY1RwvBXKnIqe8=; b=m+DGIZu6TP9V5xL8y5s6s1Mfeshi2R26YUIhLaXGaIbpIzX58vdl5+yyt9gc/R+Si3 ZbTV8kPbKtIrF251ulHWs0wNnAtvNcoLsUK3DYSAgMSIrE4s7MSPd5Rqi5f10Xdd4rPs xvIPy9Di/+/qRIDruiY0ZLWPza7cWUgVeY9CF+NLp3Iymh28BELdovWBbrRofJJivYN2 SHH1zT58SOsNqiO68neM1x52M2pOZCe50TmtMqJyx98tQtMhcq95GAtxVuhgn3FU5OqE cKL6uZq/0024hZWcgFSxGMbQbETT8cPVQcIHMAZwQyVXVQ5Jqpat0gy9yaatepjMvKH/ TqnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+MzaSrYO2WgC3Qcmfm7BGX2pGBB+hpY1RwvBXKnIqe8=; b=L+PPDyHuFl/+Q4wdp306NtvJ2nLXbOas0xUHFixtghG20nt0p9TcAdR6FYtIvjtOYv ujXuLH1rS0GCsQ9tkOF1zvzF5mg56HWmYAPQ7jl1qUnIyIS4QjSpG5ugAebIOUQ1nNiP KY/6JGsAId89/3D7lBn2J8n8DL+KzKnir/hztbTbXTiTYHA9lSJGfRW9Swy3FEX5Ydmc 3T9ow1xQMvltbTrKkj4wKreh1YLqKogm2pxzFiQJMOCVS9IK7T8ss7XPvjiaynB8etYm ULWee8Mn/NEROXbtpG/Sh03Om1utVxDPlfEO5NXqSfIAmNfJADrqrolZug0DPiQ0nR2T re4Q== X-Gm-Message-State: ABUngvfPE8eC4eYHybyasuu4PBtEp8riXHJnD71hv1dG5VQBPX8+rsrV6SSfCyGmsQGp4Q== X-Received: by 10.25.26.73 with SMTP id a70mr11811402lfa.108.1477703205634; Fri, 28 Oct 2016 18:06:45 -0700 (PDT) Received: from HP6200.Local.org (user-31-175-219-110.play-internet.pl. [31.175.219.110]) by smtp.gmail.com with ESMTPSA id n6sm2380268lfd.45.2016.10.28.18.06.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Oct 2016 18:06:45 -0700 (PDT) From: Jakub Palider To: dev@dpdk.org Date: Sat, 29 Oct 2016 03:06:15 +0200 Message-Id: <1477703175-21344-3-git-send-email-jpa@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477703175-21344-1-git-send-email-jpa@semihalf.com> References: <1477703175-21344-1-git-send-email-jpa@semihalf.com> Cc: evgenys@amazon.com, matua@amazon.com, Tal Avraham , netanel@amazon.com Subject: [dpdk-dev] [PATCH 2/2] net/ena: check for free buffers prior to xmit 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: Sat, 29 Oct 2016 01:06:46 -0000 Signed-off-by: Tal Avraham Signed-off-by: Jakub Palider --- drivers/net/ena/ena_ethdev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index adf94f2..ab9a178 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1583,7 +1583,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, struct ena_tx_buffer *tx_info; struct ena_com_buf *ebuf; uint16_t rc, req_id, total_tx_descs = 0; - uint16_t sent_idx = 0; + uint16_t sent_idx = 0, empty_tx_reqs; int nb_hw_desc; /* Check adapter state */ @@ -1593,6 +1593,10 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, return 0; } + empty_tx_reqs = ring_size - (next_to_use - next_to_clean); + if (nb_pkts > empty_tx_reqs) + nb_pkts = empty_tx_reqs; + for (sent_idx = 0; sent_idx < nb_pkts; sent_idx++) { mbuf = tx_pkts[sent_idx]; -- 2.5.0