From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f182.google.com (mail-wr0-f182.google.com [209.85.128.182]) by dpdk.org (Postfix) with ESMTP id 80D092C5 for ; Thu, 18 May 2017 17:43:09 +0200 (CEST) Received: by mail-wr0-f182.google.com with SMTP id w50so38396279wrc.0 for ; Thu, 18 May 2017 08:43:09 -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; bh=uC0j1EMgVpancvAAZOBfOX2YX/NSwav0atR86DJbVCM=; b=fj8SsRQSVqPcI+1mhMe8OV0R0c440Ao0Hwo07dGhYOY/ZL2AKxTn/bptV9UtRA4/wW uGYj11cyH9xkmCdedMgKsXYRJS8gZFQxbKTSUxijAl8v0y5cuEwRmlDyTkZX/5/9mw1G P0p8ScKX0scp2JkvG+hibTwvVhTyJ3Aa3iAAqpkkBQigDPMicZ42DF8VztrIvOBlY4TK vLy6mc3nPgCpGYIeewUzPOoM9EcxItlPp+9gT1JHgpswZP2eK4R+w5rOfpkIY40yoKjl +EN0YRiVeuOEZlJsanTDJrg6SS2leoDjmjwIuXlGRgUadiQZht5N+XKUWUkxQ8ngFqB6 qH9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=uC0j1EMgVpancvAAZOBfOX2YX/NSwav0atR86DJbVCM=; b=RY3rjz1r5fC0QqgkC4n0Rng1wRzVhxFW9NbfUzP+WIUMgi09Q/gkPJ0VZCwFGPOtRD XGyMNvbmBkJgKG/E/dfIfwJ6VN0XpYvoW/L68DAL5m1WPYnQBvx/vxHPW7MaoQphH0nk INcha///penjOddxuxHGeR9GBxIXiS+GN4aGcXJbwvxMRTbPA0M9uNxBC0cOTOhSKcb/ N1248HODiwhm6ZIYsaZSczBhUwpa5oeVJvPVHfBWWnynRGTKV+2kbtzlrRsLBZdot8JC DafM7V2PygyViVO1QIZjGKVdoqkkgV52HNOwmS6gYrbWu1WJh/Za7KuIvXPvapT6z34o rsuw== X-Gm-Message-State: AODbwcBoWFbxkMmWjqyir2iTEs2lmx7LnGQq7gxHtmTX9JeMBnjsmPRx l/bupQhkNQM39M42 X-Received: by 10.46.97.9 with SMTP id v9mr1237130ljb.87.1495122188196; Thu, 18 May 2017 08:43:08 -0700 (PDT) Received: from hp3.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id m23sm433114lfj.37.2017.05.18.08.43.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 May 2017 08:43:07 -0700 (PDT) From: Michal Krawczyk To: stable@dpdk.org Cc: mw@semihalf.com, gtzalik@amazon.com, evgenys@amazon.com, Michal Krawczyk Date: Thu, 18 May 2017 17:41:50 +0200 Message-Id: <1495122111-10373-1-git-send-email-mk@semihalf.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-stable] [PATCH 1/2] net/ena: fix Rx descriptors allocation X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 May 2017 15:43:09 -0000 [ backported from upstream commit a467e8f37a3eec98210c0c3ec04bf6e9506ddd81 ] When application tried to allocate 1024 descriptors, device was not initializing properly. This patch solves it by avoiding allocation of all descriptors in the ring in one attempt. At least one descriptor must remain unused in the HW ring. Fixes: 1173fca25af9 ("ena: add polling-mode driver") Cc: stable@dpdk.org Signed-off-by: Michal Krawczyk Reviewed-by: Jakub Palider Acked-by: Jan Medala --- drivers/net/ena/ena_ethdev.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index a62db65..f24fd26 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -908,7 +908,7 @@ static int ena_start(struct rte_eth_dev *dev) static int ena_queue_restart(struct ena_ring *ring) { - int rc; + int rc, bufs_num; ena_assert_msg(ring->configured == 1, "Trying to restart unconfigured queue\n"); @@ -919,9 +919,10 @@ static int ena_queue_restart(struct ena_ring *ring) if (ring->type == ENA_RING_TYPE_TX) return 0; - rc = ena_populate_rx_queue(ring, ring->ring_size); - if ((unsigned int)rc != ring->ring_size) { - PMD_INIT_LOG(ERR, "Failed to populate rx ring !\n"); + bufs_num = ring->ring_size - 1; + rc = ena_populate_rx_queue(ring, bufs_num); + if (rc != bufs_num) { + PMD_INIT_LOG(ERR, "Failed to populate rx ring !"); return (-1); } @@ -1132,7 +1133,7 @@ static int ena_populate_rx_queue(struct ena_ring *rxq, unsigned int count) return 0; in_use = rxq->next_to_use - rxq->next_to_clean; - ena_assert_msg(((in_use + count) <= ring_size), "bad ring state"); + ena_assert_msg(((in_use + count) < ring_size), "bad ring state"); count = RTE_MIN(count, (uint16_t)(ring_size - (next_to_use & ring_mask))); @@ -1558,6 +1559,7 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, recv_idx++; } + desc_in_use += 1; /* Burst refill to save doorbells, memory barriers, const interval */ if (ring_size - desc_in_use > ENA_RING_DESCS_RATIO(ring_size)) ena_populate_rx_queue(rx_ring, ring_size - desc_in_use); -- 2.7.4